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

Commit c2924f3

Browse files
committed
Ran black
1 parent 19b46bf commit c2924f3

File tree

9 files changed

+36
-28
lines changed

9 files changed

+36
-28
lines changed

data_diff/sqeleton/databases/databricks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
DbPath,
1414
ColType,
1515
UnknownColType,
16-
Boolean
16+
Boolean,
1717
)
1818
from ..abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue
1919
from .base import MD5_HEXDIGITS, CHECKSUM_HEXDIGITS, BaseDialect, ThreadedDatabase, import_helper, parse_table_name

data_diff/sqeleton/databases/oracle.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@ def normalize_number(self, value: str, coltype: FractionalType) -> str:
5959
format_str += "0." + "9" * (coltype.precision - 1) + "0"
6060
return f"to_char({value}, '{format_str}')"
6161

62+
6263
class Mixin_Schema(AbstractMixin_Schema):
6364
def list_tables(self, table_schema: str, like: Compilable = None) -> Compilable:
6465
return (
65-
table('ALL_TABLES')
66+
table("ALL_TABLES")
6667
.where(
6768
this.OWNER == table_schema,
6869
this.TABLE_NAME.like(like) if like is not None else SKIP,
6970
)
70-
.select(table_name = this.TABLE_NAME)
71+
.select(table_name=this.TABLE_NAME)
7172
)
7273

7374

data_diff/table_segment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def source_table(self):
100100
return table(*self.table_path, schema=self._schema)
101101

102102
def make_select(self):
103-
return self.source_table.where(*self._make_key_range(), *self._make_update_range(), Code(self.where) if self.where else SKIP)
103+
return self.source_table.where(
104+
*self._make_key_range(), *self._make_update_range(), Code(self.where) if self.where else SKIP
105+
)
104106

105107
def get_values(self) -> list:
106108
"Download all the relevant values of the segment from the database"

tests/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ def setUp(self):
152152

153153
if self.src_schema:
154154
self.src_table = table(self.table_src_path, schema=self.src_schema)
155-
self.connection.query( self.src_table.create() )
155+
self.connection.query(self.src_table.create())
156156
if self.dst_schema:
157157
self.dst_table = table(self.table_dst_path, schema=self.dst_schema)
158-
self.connection.query( self.dst_table.create() )
158+
self.connection.query(self.dst_table.create())
159159

160160
return super().setUp()
161161

tests/sqeleton/test_database.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from ..common import str_to_checksum, TEST_MYSQL_CONN_STRING
55
from ..common import str_to_checksum, test_each_database_in_list, DiffTestCase, get_conn, random_table_suffix
6+
67
# from data_diff.sqeleton import databases as db
78
# from data_diff.sqeleton import connect
89

@@ -53,16 +54,15 @@ def test_bad_uris(self):
5354

5455
@test_each_database
5556
class TestSchema(unittest.TestCase):
56-
5757
def test_table_list(self):
58-
name = 'tbl_' + random_table_suffix()
58+
name = "tbl_" + random_table_suffix()
5959
db = get_conn(self.db_cls)
60-
tbl = table(db.parse_table_name(name), schema={'id': int})
60+
tbl = table(db.parse_table_name(name), schema={"id": int})
6161
q = db.dialect.list_tables(db.default_schema, name)
6262
assert not db.query(q)
6363

6464
db.query(tbl.create())
65-
self.assertEqual( db.query(q, List[str] ), [name])
65+
self.assertEqual(db.query(q, List[str]), [name])
6666

67-
db.query( tbl.drop() )
67+
db.query(tbl.drop())
6868
assert not db.query(q)

tests/sqeleton/test_query.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def test_basic(self):
7474
assert c.compile(t) == "SELECT * FROM point WHERE (x = 1) AND (y = 2)"
7575

7676
t = table("person").where(this.name == "Albert")
77-
self.assertEqual( c.compile(t), "SELECT * FROM person WHERE (name = 'Albert')" )
78-
77+
self.assertEqual(c.compile(t), "SELECT * FROM person WHERE (name = 'Albert')")
7978

8079
def test_outerjoin(self):
8180
c = Compiler(MockDatabase())

tests/sqeleton/test_sql.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def test_in(self):
7373
expected_sql = "SELECT name FROM `marine_mammals`.`walrus` WHERE (id IN (1, 2, 3))"
7474
self.assertEqual(
7575
expected_sql,
76-
self.compiler.compile(Select(table("marine_mammals", "walrus"), [Code("name")], [In(Code("id"), [1, 2, 3])])),
76+
self.compiler.compile(
77+
Select(table("marine_mammals", "walrus"), [Code("name")], [In(Code("id"), [1, 2, 3])])
78+
),
7779
)
7880

7981
def test_count(self):
@@ -87,7 +89,9 @@ def test_count_with_column(self):
8789
expected_sql = "SELECT count(id) FROM `marine_mammals`.`walrus` WHERE (id IN (1, 2, 3))"
8890
self.assertEqual(
8991
expected_sql,
90-
self.compiler.compile(Select(table("marine_mammals", "walrus"), [Count(Code("id"))], [In(Code("id"), [1, 2, 3])])),
92+
self.compiler.compile(
93+
Select(table("marine_mammals", "walrus"), [Count(Code("id"))], [In(Code("id"), [1, 2, 3])])
94+
),
9195
)
9296

9397
def test_explain(self):

tests/test_database_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def _create_table_with_indexes(conn, table_path, type_):
610610
conn.query(tbl.create())
611611

612612
if conn.dialect.SUPPORTS_INDEXES:
613-
index_id ,= table_path
613+
(index_id,) = table_path
614614
conn.query(f"CREATE INDEX xa_{index_id} ON {table_name} ({quote('id')}, {quote('col')})")
615615
conn.query(f"CREATE INDEX xb_{index_id} ON {table_name} ({quote('id')})")
616616

tests/test_diff_tables.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,12 @@ def setUp(self):
383383
]
384384
)
385385

386-
self.a = _table_segment(self.connection, self.table_src_path, "id", extra_columns=("text_comment",), case_sensitive=False).with_schema()
387-
self.b = _table_segment(self.connection, self.table_dst_path, "id", extra_columns=("text_comment",), case_sensitive=False).with_schema()
386+
self.a = _table_segment(
387+
self.connection, self.table_src_path, "id", extra_columns=("text_comment",), case_sensitive=False
388+
).with_schema()
389+
self.b = _table_segment(
390+
self.connection, self.table_dst_path, "id", extra_columns=("text_comment",), case_sensitive=False
391+
).with_schema()
388392

389393
def test_string_keys(self):
390394
differ = HashDiffer(bisection_factor=2)
@@ -706,17 +710,13 @@ def setUp(self):
706710
self.b = _table_segment(self.connection, self.table_dst_path, "id", "text_comment", case_sensitive=False)
707711

708712
def test_right_table_empty(self):
709-
self.connection.query(
710-
[self.src_table.insert_rows(self.diffs), commit]
711-
)
713+
self.connection.query([self.src_table.insert_rows(self.diffs), commit])
712714

713715
differ = HashDiffer(bisection_factor=2)
714716
self.assertRaises(ValueError, list, differ.diff_tables(self.a, self.b))
715717

716718
def test_left_table_empty(self):
717-
self.connection.query(
718-
[self.dst_table.insert_rows(self.diffs), commit]
719-
)
719+
self.connection.query([self.dst_table.insert_rows(self.diffs), commit])
720720

721721
differ = HashDiffer(bisection_factor=2)
722722
self.assertRaises(ValueError, list, differ.diff_tables(self.a, self.b))
@@ -728,10 +728,12 @@ class TestInfoTree(DiffTestCase):
728728

729729
def test_info_tree_root(self):
730730
db = self.connection
731-
db.query([
732-
self.src_table.insert_rows([i] for i in range(1000)),
733-
self.dst_table.insert_rows([i] for i in range(2000)),
734-
])
731+
db.query(
732+
[
733+
self.src_table.insert_rows([i] for i in range(1000)),
734+
self.dst_table.insert_rows([i] for i in range(2000)),
735+
]
736+
)
735737

736738
ts1 = TableSegment(db, self.src_table.path, ("id",))
737739
ts2 = TableSegment(db, self.dst_table.path, ("id",))

0 commit comments

Comments
 (0)