Skip to content

Commit 567030a

Browse files
committed
Fix Bigquery! Allow to test bigquery with snowflake
1 parent 3fa2d5f commit 567030a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

data_diff/sqeleton/databases/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,12 @@ def query(self, sql_ast: Union[Expr, Generator], res_type: type = list):
298298

299299
res = self._query(sql_code)
300300
if res_type is int:
301-
res = _one(_one(res))
301+
if not res:
302+
raise ValueError("Query returned 0 rows, expected 1")
303+
row = _one(res)
304+
if not row:
305+
raise ValueError("Row is empty, expected 1 column")
306+
res = _one(row)
302307
if res is None: # May happen due to sum() of 0 items
303308
return None
304309
return int(res)

data_diff/sqeleton/databases/bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
3737
return f"FORMAT_TIMESTAMP('%F %H:%M:%E6S', {timestamp})"
3838

3939
if coltype.precision == 0:
40-
return f"FORMAT_TIMESTAMP('%F %H:%M:%S.000000, {value})"
40+
return f"FORMAT_TIMESTAMP('%F %H:%M:%S.000000', {value})"
4141
elif coltype.precision == 6:
4242
return f"FORMAT_TIMESTAMP('%F %H:%M:%E6S', {value})"
4343

tests/common.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ def get_git_revision_short_hash() -> str:
6565
except ImportError:
6666
pass # No local settings
6767

68-
if TEST_BIGQUERY_CONN_STRING and TEST_SNOWFLAKE_CONN_STRING:
69-
# TODO Fix this. Seems to have something to do with pyarrow
70-
raise RuntimeError("Using BigQuery at the same time as Snowflake causes an error!!")
7168

7269
CONN_STRINGS = {
7370
db.BigQuery: TEST_BIGQUERY_CONN_STRING,

0 commit comments

Comments
 (0)