Skip to content

Commit

Permalink
fix(tap-suiteql): Lint adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos314 committed Oct 19, 2023
1 parent 5094172 commit 44b50b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 7 additions & 5 deletions tap_suiteql/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ def _build_from_statement(self):
def _build_where_statement(self):
where_clauses = ["1=1"]
where_statement = "where "

if self.stream.year_date_field: # Filter added due to the limit of 100 thousand records that the Sensedata API returns

if (
self.stream.year_date_field
): # Filter added due to the limit of 100 thousand records that the Sensedata API returns # noqa:E501
where_clauses.append(
f"TO_CHAR({self.stream.year_date_field}, 'YYYY') >= 2023 and {self.stream.year_date_field} < ADD_MONTHS(SYSDATE, 3)" #noqa:E501
)
f"TO_CHAR({self.stream.year_date_field}, 'YYYY') >= 2023 and {self.stream.year_date_field} < ADD_MONTHS(SYSDATE, 3)" # noqa:E501
)

if self.stream.replication_key:
where_clauses.append(
f"{self.stream.replication_key} >= TO_DATE(:{self.stream.replication_key}, 'YYYY-MM-DD\"T\"HH24:MI:SS')" # noqa:E501
Expand Down
3 changes: 1 addition & 2 deletions tap_suiteql/tests/test_query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ class DummyStreamWithFilter:
"col_id": {},
"col_1": {},
"col_2": {},
"year_date_field": {"format": "date-time"},
"year_date_field": {"format": "date-time"},
},
}



def test_sql_builder_with_replication_key():
expected = """select col_id,col_1,col_2,TO_CHAR(date_col, 'YYYY-MM-DD\"T\"HH24:MI:SS') date_col,TO_CHAR(replication_key_col, 'YYYY-MM-DD\"T\"HH24:MI:SS') replication_key_col
from dummy
Expand Down

0 comments on commit 44b50b1

Please sign in to comment.