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

Commit 97c5e6a

Browse files
authored
Merge pull request #212 from datafold/aug18
Various fixes (issue #211, #208)
2 parents 6af1245 + b3e9b22 commit 97c5e6a

File tree

4 files changed

+76
-119
lines changed

4 files changed

+76
-119
lines changed

data_diff/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def diff_tables(
4141
table2: TableSegment,
4242
*,
4343
# Name of the key column, which uniquely identifies each row (usually id)
44-
key_column: str = "id",
44+
key_column: str = None,
4545
# Name of updated column, which signals that rows changed (usually updated_at or last_update)
4646
update_column: str = None,
4747
# Extra columns to compare
48-
extra_columns: Tuple[str, ...] = (),
48+
extra_columns: Tuple[str, ...] = None,
4949
# Start/end key_column values, used to restrict the segment
5050
min_key: DbKey = None,
5151
max_key: DbKey = None,
@@ -73,18 +73,17 @@ def diff_tables(
7373
7474
"""
7575
tables = [table1, table2]
76-
segments = [
77-
t.new(
76+
override_attrs = {k:v for k,v in dict(
7877
key_column=key_column,
7978
update_column=update_column,
8079
extra_columns=extra_columns,
8180
min_key=min_key,
8281
max_key=max_key,
8382
min_update=min_update,
8483
max_update=max_update,
85-
)
86-
for t in tables
87-
]
84+
).items() if v is not None}
85+
86+
segments = [t.new(**override_attrs) for t in tables] if override_attrs else tables
8887

8988
differ = TableDiffer(
9089
bisection_factor=bisection_factor,

data_diff/databases/mysql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create_connection(self):
4747
elif e.errno == mysql.errorcode.ER_BAD_DB_ERROR:
4848
raise ConnectError("Database does not exist") from e
4949
else:
50-
raise ConnectError(*e) from e
50+
raise ConnectError(*e.args) from e
5151

5252
def quote(self, s: str):
5353
return f"`{s}`"

0 commit comments

Comments
 (0)