findly.unified-reporting-sdk 0.6.20__py3-none-any.whl → 0.6.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,7 @@ def parse_where_columns_from_sql_query(
79
79
  pass
80
80
 
81
81
  column_operator_used_for_where_clause = condition.key
82
- if column_operator_used_for_where_clause == "in":
82
+ if column_operator_used_for_where_clause.lower() == "in":
83
83
  # expression list cause this is an IN operator, so we get back
84
84
  # an array, lets handle that by iterating over the expressions
85
85
  for expression in condition.expressions:
@@ -91,7 +91,7 @@ def parse_where_columns_from_sql_query(
91
91
  is_not_condition=not_condition,
92
92
  )
93
93
  )
94
- elif column_operator_used_for_where_clause == "between":
94
+ elif column_operator_used_for_where_clause.lower() == "between":
95
95
  where_clause_values.append(
96
96
  WhereClauseInformation(
97
97
  column_name=condition.args["this"].sql(),
@@ -100,6 +100,19 @@ def parse_where_columns_from_sql_query(
100
100
  is_not_condition=not_condition,
101
101
  )
102
102
  )
103
+ # Handle LIKE operator specifically
104
+ elif column_operator_used_for_where_clause.lower() == "like":
105
+ # Ensure correct handling of LIKE patterns, including special characters
106
+ column_name = condition.this.sql()
107
+ column_value = condition.expression.sql()
108
+ where_clause_values.append(
109
+ WhereClauseInformation(
110
+ column_name=column_name,
111
+ column_operator="like",
112
+ column_value=column_value,
113
+ is_not_condition=not_condition,
114
+ )
115
+ )
103
116
  else:
104
117
  # We fail on parsing things like:
105
118
  # CAST(A as B)
@@ -169,3 +182,12 @@ def parse_where_column_condition(
169
182
  dialect=dialect,
170
183
  where_clause_str=where_clause_str,
171
184
  )
185
+
186
+
187
+ # main method to test it
188
+ if __name__ == "__main__":
189
+ # ERROR:findly.unified_reporting_sdk.data_sources.common.where_string_comparison:{'msg': 'error_parse_where_column_condition', 'where_clause': "WHERE LOWER(cargo) LIKE LOWER('%crude%') AND WHERE LOWER(imo__ais_destination_formatted) LIKE LOWER(%rotterdam%) ", 'sql_query': "select * from table WHERE LOWER(cargo) LIKE LOWER('%crude%') AND WHERE LOWER(imo__ais_destination_formatted) LIKE LOWER(%rotterdam%) ", 'error': "Required keyword: 'expression' missing for <class 'sqlglot.expressions.And'>. Line 1, Col: 70.\n select * from table WHERE LOWER(cargo) LIKE LOWER('%crude%') AND \x1b[4mWHERE\x1b[0m LOWER(imo__ais_destination_formatted) LIKE LOWER(%rotterdam%) "}
190
+ # i want to test this case above
191
+ where_clause_str = "WHERE LOWER(cargo) LIKE LOWER('%crude%') AND WHERE LOWER(imo__ais_destination_formatted) LIKE LOWER(%rotterdam%) "
192
+ dialect = "bigquery"
193
+ print(parse_where_column_condition(where_clause_str, dialect))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: findly.unified-reporting-sdk
3
- Version: 0.6.20
3
+ Version: 0.6.21
4
4
  Summary:
5
5
  License: GPL-3.0-only
6
6
  Requires-Python: >=3.9,<4.0
@@ -5,7 +5,7 @@ findly/unified_reporting_sdk/data_sources/common/__init__.py,sha256=47DEQpj8HBSa
5
5
  findly/unified_reporting_sdk/data_sources/common/common_parser.py,sha256=OymaK3T9U10ZiIpMqwYQv3ukvCmBu9ALgxS5zQmKpLY,7897
6
6
  findly/unified_reporting_sdk/data_sources/common/date_range_helper.py,sha256=z2L1YU1Mzbybkl1wZK_mXL9lKFfG6CEomvlTfADD_80,971
7
7
  findly/unified_reporting_sdk/data_sources/common/reports_client.py,sha256=fCza94iwZz05QPr6B3mmsrvQQdymgD3CzMbvAYEOetw,3647
8
- findly/unified_reporting_sdk/data_sources/common/where_string_comparison.py,sha256=vQWxmX2T6-_PRIFBqfW18-5xLWdDICG2iM4TP04RZSY,6408
8
+ findly/unified_reporting_sdk/data_sources/common/where_string_comparison.py,sha256=SUueYVxJrItDBwUJ04U5JlhebIbN_0eLuWsmrlO83Yw,8070
9
9
  findly/unified_reporting_sdk/data_sources/fb_ads/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  findly/unified_reporting_sdk/data_sources/fb_ads/fb_ads_client.py,sha256=hVrxsbf0DLoTka5B7DACBbcMeVEh4PRU_s8WZ8nlvFY,21913
11
11
  findly/unified_reporting_sdk/data_sources/fb_ads/fb_ads_query_args_parser.py,sha256=kM1ewN1bQqL_hTfbItkPGJenbwYeEpUXZEYnoTjTbDo,31949
@@ -28,7 +28,7 @@ findly/unified_reporting_sdk/protos/findly_semantic_layer_pb2.pyi,sha256=PmMDYAW
28
28
  findly/unified_reporting_sdk/urs.py,sha256=8um_pLJNOu1FGd0IO7XlNBIFAvGYD2nXnxiHMjkraKs,2915
29
29
  findly/unified_reporting_sdk/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  findly/unified_reporting_sdk/util/create_numeric_string_series.py,sha256=MmufpYatIhcVxA9e3H1dR1CrejXRnA8j4NNjJxfvBVA,457
31
- findly_unified_reporting_sdk-0.6.20.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
32
- findly_unified_reporting_sdk-0.6.20.dist-info/METADATA,sha256=JL01Y3tesvOCdxLS-f_bQyhe9rHnlAPsNmrrxSi66uM,3160
33
- findly_unified_reporting_sdk-0.6.20.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
34
- findly_unified_reporting_sdk-0.6.20.dist-info/RECORD,,
31
+ findly_unified_reporting_sdk-0.6.21.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
32
+ findly_unified_reporting_sdk-0.6.21.dist-info/METADATA,sha256=CLvuNbY41ZHgs9oUSZdXvOw25ChIt7NuYOWqy74m9yE,3160
33
+ findly_unified_reporting_sdk-0.6.21.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
34
+ findly_unified_reporting_sdk-0.6.21.dist-info/RECORD,,