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

Commit f33f6b8

Browse files
committed
Now accepting multiple -k arguments
1 parent 0a6e3bf commit f33f6b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

data_diff/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def _remove_passwords_in_dict(d: dict):
4040
@click.argument("table1", required=False)
4141
@click.argument("database2", required=False)
4242
@click.argument("table2", required=False)
43-
@click.option("-k", "--key-column", default=None, help="Name of primary key column. Default='id'.")
43+
@click.option("-k", "--key-column", multiple=True, help="Names of primary key columns. Default='id'.")
4444
@click.option("-t", "--update-column", default=None, help="Name of updated_at/last_updated column")
45-
@click.option("-c", "--columns", default=[], multiple=True, help="Names of extra columns to compare")
45+
@click.option("-c", "--columns", multiple=True, help="Names of extra columns to compare")
4646
@click.option("-l", "--limit", default=None, help="Maximum number of differences to find")
4747
@click.option("--bisection-factor", default=None, help=f"Segments per iteration. Default={DEFAULT_BISECTION_FACTOR}.")
4848
@click.option(
@@ -130,7 +130,7 @@ def _main(
130130
logging.error("Cannot specify a limit when using the -s/--stats switch")
131131
return
132132

133-
key_column = key_column or ("id",)
133+
key_columns = tuple(key_column) or ("id",)
134134
if bisection_factor is None:
135135
bisection_factor = DEFAULT_BISECTION_FACTOR
136136
if bisection_threshold is None:
@@ -172,8 +172,8 @@ def _main(
172172
logging.error("Error while parsing age expression: %s" % e)
173173
return
174174

175-
table1_seg = TableSegment(db1, db1.parse_table_name(table1), (key_column,), update_column, columns, **options)
176-
table2_seg = TableSegment(db2, db2.parse_table_name(table2), (key_column,), update_column, columns, **options)
175+
table1_seg = TableSegment(db1, db1.parse_table_name(table1), key_columns, update_column, columns, **options)
176+
table2_seg = TableSegment(db2, db2.parse_table_name(table2), key_columns, update_column, columns, **options)
177177

178178
differ = TableDiffer(
179179
bisection_factor=bisection_factor,

0 commit comments

Comments
 (0)