Skip to content

Commit

Permalink
chore(tap-suitql): Change year from filter in query builder (#46)
Browse files Browse the repository at this point in the history
* chore(tap-suitql): Change year from filter in query builder

* chore(tap-suiteql) add test
  • Loading branch information
arthurferreira1 authored May 9, 2024
1 parent 88217a0 commit 48af4f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tap_suiteql/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _build_where_statement(self):
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') >= 2024 and {self.stream.year_date_field} < ADD_MONTHS(SYSDATE, 3)" # noqa:E501
)

if self.stream.replication_key:
Expand Down
2 changes: 1 addition & 1 deletion tap_suiteql/tests/test_query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_sql_builder_from_transaction():
def test_sql_builder_with_filter():
expected = """select col_id,col_1,col_2,TO_CHAR(year_date_field, 'YYYY-MM-DD\"T\"HH24:MI:SS') year_date_field
from dummy_with_stream
where 1=1 and TO_CHAR(year_date_field, 'YYYY') >= 2023 and year_date_field < ADD_MONTHS(SYSDATE, 3)
where 1=1 and TO_CHAR(year_date_field, 'YYYY') >= 2024 and year_date_field < ADD_MONTHS(SYSDATE, 3)
order by col_id""" # noqa:E501

query = QueryBuilder(DummyStreamWithFilter).query()
Expand Down

0 comments on commit 48af4f6

Please sign in to comment.