Skip to content

Commit

Permalink
reintroduce more brittle sql-replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
ADBond committed Sep 30, 2024
1 parent 3ce1327 commit d53d856
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions splinkclickhouse/chdb/database_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def _setup_for_execute_sql(self, sql: str, physical_name: str) -> str:
# workaround for https://github.com/ClickHouse/ClickHouse/issues/61004
sql = sql.replace("count(*)", "count()")
sql = sql.replace("COUNT(*)", "COUNT()")
# TODO: very sorry for this
# avoids 'double selection' issue in creating __splink__block_counts
sql = sql.replace(", count_l, count_r,", ",")

sql = f"CREATE TABLE {physical_name} ORDER BY tuple() AS {sql}"
return sql
Expand Down
3 changes: 3 additions & 0 deletions splinkclickhouse/clickhouse/database_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def _setup_for_execute_sql(self, sql: str, physical_name: str) -> str:
# workaround for https://github.com/ClickHouse/ClickHouse/issues/61004
sql = sql.replace("count(*)", "count()")
sql = sql.replace("COUNT(*)", "COUNT()")
# TODO: very sorry for this
# avoids 'double selection' issue in creating __splink__block_counts
sql = sql.replace(", count_l, count_r,", ",")

sql = f"CREATE TABLE {physical_name} ORDER BY tuple() AS {sql}"
return sql
Expand Down

0 comments on commit d53d856

Please sign in to comment.