Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions data_diff/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,11 @@ def _main(
)
return

try:
db1 = connect(database1, threads1 or threads)
if database1 == database2:
db2 = db1
else:
db2 = connect(database2, threads2 or threads)
except Exception as e:
logging.error(e)
return
db1 = connect(database1, threads1 or threads)
if database1 == database2:
db2 = db1
else:
db2 = connect(database2, threads2 or threads)

now: datetime = db1.query(current_timestamp(), datetime)
now = now.replace(tzinfo=None)
Expand Down
3 changes: 2 additions & 1 deletion data_diff/sqeleton/databases/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
)
from ..abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue

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

@import_helper("clickhouse")
def import_clickhouse():
Expand Down Expand Up @@ -164,7 +165,7 @@ def __init__(self, *, thread_count: int, **kw):

self._args = kw
# In Clickhouse database and schema are the same
self.default_schema = kw["database"]
self.default_schema = kw.get("database", DEFAULT_DATABASE)

def create_connection(self):
clickhouse = import_clickhouse()
Expand Down
5 changes: 4 additions & 1 deletion data_diff/sqeleton/databases/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def __init__(self, *, thread_count, **kw):
super().__init__(thread_count=thread_count)

# In MySQL schema and database are synonymous
self.default_schema = kw["database"]
try:
self.default_schema = kw["database"]
except KeyError:
raise ValueError("MySQL URL must specify a database")

def create_connection(self):
mysql = import_mysql()
Expand Down