Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 8e02105

Browse files
committed
Clickhouse: Default database is now 'default'. (issue #317)
1 parent e367da4 commit 8e02105

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

data_diff/__main__.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,11 @@ def _main(
307307
)
308308
return
309309

310-
try:
311-
db1 = connect(database1, threads1 or threads)
312-
if database1 == database2:
313-
db2 = db1
314-
else:
315-
db2 = connect(database2, threads2 or threads)
316-
except Exception as e:
317-
logging.error(e)
318-
return
310+
db1 = connect(database1, threads1 or threads)
311+
if database1 == database2:
312+
db2 = db1
313+
else:
314+
db2 = connect(database2, threads2 or threads)
319315

320316
now: datetime = db1.query(current_timestamp(), datetime)
321317
now = now.replace(tzinfo=None)

data_diff/sqeleton/databases/clickhouse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
)
2424
from ..abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue
2525

26+
DEFAULT_DATABASE = "default" # https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings/#default-database
2627

2728
@import_helper("clickhouse")
2829
def import_clickhouse():
@@ -164,7 +165,7 @@ def __init__(self, *, thread_count: int, **kw):
164165

165166
self._args = kw
166167
# In Clickhouse database and schema are the same
167-
self.default_schema = kw["database"]
168+
self.default_schema = kw.get("database", DEFAULT_DATABASE)
168169

169170
def create_connection(self):
170171
clickhouse = import_clickhouse()

0 commit comments

Comments
 (0)