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

Commit 0b4efe0

Browse files
committed
black
1 parent 0343a6e commit 0b4efe0

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

data_diff/databases/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ def query_table_schema(self, path: DbPath) -> Dict[str, tuple]:
233233
assert len(d) == len(rows)
234234
return d
235235

236-
237236
def select_table_unique_columns(self, path: DbPath) -> str:
238237
schema, table = self._normalize_table_path(path)
239238

data_diff/databases/database_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ def select_table_unique_columns(self, path: DbPath) -> str:
260260

261261
@abstractmethod
262262
def query_table_unique_columns(self, path: DbPath) -> List[str]:
263-
"""Query the table for its unique columns for table in 'path', and return {column}
264-
"""
263+
"""Query the table for its unique columns for table in 'path', and return {column}"""
265264
...
266265

267266
@abstractmethod

data_diff/joindiff_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def _test_duplicate_keys(self, table1: TableSegment, table2: TableSegment):
203203
unvalidated = list(set(key_columns) - set(unique))
204204
if unvalidated:
205205
# Validate that there are no duplicate keys
206-
self.stats['validated_unique_keys'] = self.stats.get('validated_unique_keys', []) + [unvalidated]
206+
self.stats["validated_unique_keys"] = self.stats.get("validated_unique_keys", []) + [unvalidated]
207207
q = t.select(total=Count(), total_distinct=Count(Concat(this[unvalidated]), distinct=True))
208208
total, total_distinct = ts.database.query(q, tuple)
209209
if total != total_distinct:

data_diff/queries/ast_classes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,11 @@ def compile(self, c: Compiler) -> str:
655655
return f"CREATE TABLE {ne}{c.compile(self.path)} AS {c.compile(self.source_table)}"
656656

657657
schema = ", ".join(f"{c.database.quote(k)} {c.database.type_repr(v)}" for k, v in self.path.schema.items())
658-
pks = ", PRIMARY KEY (%s)" % ', '.join(self.primary_keys) if self.primary_keys and c.database.SUPPORTS_PRIMARY_KEY else ""
658+
pks = (
659+
", PRIMARY KEY (%s)" % ", ".join(self.primary_keys)
660+
if self.primary_keys and c.database.SUPPORTS_PRIMARY_KEY
661+
else ""
662+
)
659663
return f"CREATE TABLE {ne}{c.compile(self.path)}({schema}{pks})"
660664

661665

data_diff/query_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .databases import Oracle
99
from .queries import table, commit, Expr
1010

11+
1112
def _drop_table_oracle(name: DbPath):
1213
t = table(name)
1314
# Experience shows double drop is necessary
@@ -50,6 +51,7 @@ def _append_to_table(path: DbPath, expr: Expr):
5051
yield t.insert_expr(expr)
5152
yield commit
5253

54+
5355
def append_to_table(db, path, expr):
5456
f = _append_to_table_oracle if isinstance(db, Oracle) else _append_to_table
5557
db.query(f(path, expr))

tests/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ def str_to_checksum(str: str):
120120
return int(md5[half_pos:], 16)
121121

122122

123-
124123
class TestPerDatabase(unittest.TestCase):
125124
db_cls = None
126125

tests/test_diff_tables.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,7 @@ def test_string_keys(self):
383383
diff = list(differ.diff_tables(self.a, self.b))
384384
self.assertEqual(diff, [("-", (str(self.new_uuid), "This one is different"))])
385385

386-
self.connection.query(
387-
self.src_table.insert_row('unexpected', '<-- this bad value should not break us')
388-
)
386+
self.connection.query(self.src_table.insert_row("unexpected", "<-- this bad value should not break us"))
389387

390388
self.assertRaises(ValueError, list, differ.diff_tables(self.a, self.b))
391389

@@ -421,7 +419,7 @@ def setUp(self):
421419
src_table.create(),
422420
src_table.insert_rows(values),
423421
table(self.table_dst_path).create(src_table),
424-
src_table.insert_row(self.new_alphanum, 'This one is different'),
422+
src_table.insert_row(self.new_alphanum, "This one is different"),
425423
commit,
426424
]
427425

@@ -491,7 +489,7 @@ def test_varying_alphanum_keys(self):
491489
self.assertEqual(diff, [("-", (str(self.new_alphanum), "This one is different"))])
492490

493491
self.connection.query(
494-
self.src_table.insert_row('@@@', '<-- this bad value should not break us'),
492+
self.src_table.insert_row("@@@", "<-- this bad value should not break us"),
495493
commit,
496494
)
497495

@@ -548,13 +546,15 @@ def setUp(self):
548546

549547
self.null_uuid = uuid.uuid1(32132131)
550548

551-
self.connection.query([
552-
src_table.create(),
553-
src_table.insert_rows(values),
554-
table(self.table_dst_path).create(src_table),
555-
src_table.insert_row(self.null_uuid, None),
556-
commit,
557-
])
549+
self.connection.query(
550+
[
551+
src_table.create(),
552+
src_table.insert_rows(values),
553+
table(self.table_dst_path).create(src_table),
554+
src_table.insert_row(self.null_uuid, None),
555+
commit,
556+
]
557+
)
558558

559559
self.a = _table_segment(self.connection, self.table_src_path, "id", "text_comment", case_sensitive=False)
560560
self.b = _table_segment(self.connection, self.table_dst_path, "id", "text_comment", case_sensitive=False)
@@ -576,9 +576,9 @@ def setUp(self):
576576
self.connection.query(
577577
[
578578
src_table.create(),
579-
src_table.insert_row(uuid.uuid1(1), '1'),
579+
src_table.insert_row(uuid.uuid1(1), "1"),
580580
table(self.table_dst_path).create(src_table),
581-
src_table.insert_row(self.null_uuid, None), # Add a row where a column has NULL value
581+
src_table.insert_row(self.null_uuid, None), # Add a row where a column has NULL value
582582
commit,
583583
]
584584
)

tests/test_joindiff.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,8 @@ def setUp(self):
281281
schema={"id": int, "userid": int, "movieid": int, "rating": float},
282282
)
283283

284-
self.connection.query([
285-
self.src_table.create(primary_keys=['id']),
286-
self.dst_table.create(primary_keys=['id', 'userid']),
287-
commit
288-
]
284+
self.connection.query(
285+
[self.src_table.create(primary_keys=["id"]), self.dst_table.create(primary_keys=["id", "userid"]), commit]
289286
)
290287

291288
self.differ = JoinDiffer()
@@ -305,12 +302,12 @@ def test_unique_constraint(self):
305302

306303
res = list(self.differ.diff_tables(table, table2))
307304
assert not res
308-
assert 'validated_unique_keys' not in self.differ.stats
305+
assert "validated_unique_keys" not in self.differ.stats
309306

310307
# Test active validation
311308
table = TableSegment(self.connection, self.table_src_path, ("userid",), case_sensitive=False)
312309
table2 = TableSegment(self.connection, self.table_dst_path, ("userid",), case_sensitive=False)
313310

314311
res = list(self.differ.diff_tables(table, table2))
315312
assert not res
316-
self.assertEqual( self.differ.stats['validated_unique_keys'], [['userid']] )
313+
self.assertEqual(self.differ.stats["validated_unique_keys"], [["userid"]])

0 commit comments

Comments
 (0)