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

Commit c36ff0a

Browse files
author
Sergey Vasilyev
committed
Fix the aftermath of refactoring: incompletely removed mixins
1 parent 902fcc6 commit c36ff0a

14 files changed

+0
-31
lines changed

data_diff/databases/base.py

-12
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ class BaseDialect(abc.ABC):
240240
SUPPORTS_PRIMARY_KEY = False
241241
SUPPORTS_INDEXES = False
242242
TYPE_CLASSES: Dict[str, type] = {}
243-
MIXINS = frozenset()
244243

245244
PLACEHOLDER_TABLE = None # Used for Oracle
246245

@@ -785,17 +784,6 @@ def _convert_db_precision_to_digits(self, p: int) -> int:
785784
# See: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
786785
return math.floor(math.log(2**p, 10))
787786

788-
@classmethod
789-
def load_mixins(cls, *abstract_mixins) -> Self:
790-
"Load a list of mixins that implement the given abstract mixins"
791-
mixins = {m for m in cls.MIXINS if issubclass(m, abstract_mixins)}
792-
793-
class _DialectWithMixins(cls, *mixins, *abstract_mixins):
794-
pass
795-
796-
_DialectWithMixins.__name__ = cls.__name__
797-
return _DialectWithMixins()
798-
799787
@property
800788
@abstractmethod
801789
def name(self) -> str:

data_diff/databases/bigquery.py

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ class Dialect(
161161
}
162162
TYPE_ARRAY_RE = re.compile(r"ARRAY<(.+)>")
163163
TYPE_STRUCT_RE = re.compile(r"STRUCT<(.+)>")
164-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_TimeTravel, Mixin_RandomSample}
165164

166165
def random(self) -> str:
167166
return "RAND()"

data_diff/databases/clickhouse.py

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class Dialect(BaseDialect, Mixin_MD5, Mixin_NormalizeValue, AbstractMixin_MD5, A
125125
"DateTime64": Timestamp,
126126
"Bool": Boolean,
127127
}
128-
MIXINS = {Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
129128

130129
def quote(self, s: str) -> str:
131130
return f'"{s}"'

data_diff/databases/databricks.py

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class Dialect(BaseDialect, Mixin_MD5, Mixin_NormalizeValue, AbstractMixin_MD5, A
7979
# Boolean
8080
"BOOLEAN": Boolean,
8181
}
82-
MIXINS = {Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
8382

8483
def quote(self, s: str):
8584
return f"`{s}`"

data_diff/databases/duckdb.py

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class Dialect(
7575
ROUNDS_ON_PREC_LOSS = False
7676
SUPPORTS_PRIMARY_KEY = True
7777
SUPPORTS_INDEXES = True
78-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
7978

8079
TYPE_CLASSES = {
8180
# Timestamps

data_diff/databases/mssql.py

-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ class Dialect(
106106
"json": JSON,
107107
}
108108

109-
MIXINS = {Mixin_Schema, Mixin_NormalizeValue, Mixin_RandomSample}
110-
111109
def quote(self, s: str):
112110
return f"[{s}]"
113111

data_diff/databases/mysql.py

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ class Dialect(
9999
# Boolean
100100
"boolean": Boolean,
101101
}
102-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
103102

104103
def quote(self, s: str):
105104
return f"`{s}`"

data_diff/databases/oracle.py

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ class Dialect(
104104
}
105105
ROUNDS_ON_PREC_LOSS = True
106106
PLACEHOLDER_TABLE = "DUAL"
107-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
108107

109108
def quote(self, s: str):
110109
return f'"{s}"'

data_diff/databases/postgresql.py

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class PostgresqlDialect(
6767
ROUNDS_ON_PREC_LOSS = True
6868
SUPPORTS_PRIMARY_KEY = True
6969
SUPPORTS_INDEXES = True
70-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
7170

7271
TYPE_CLASSES = {
7372
# Timestamps

data_diff/databases/presto.py

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class Dialect(
9696
# Boolean
9797
"boolean": Boolean,
9898
}
99-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
10099

101100
def explain_as_text(self, query: str) -> str:
102101
return f"EXPLAIN (FORMAT TEXT) {query}"

data_diff/databases/snowflake.py

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class Dialect(
123123
# Boolean
124124
"BOOLEAN": Boolean,
125125
}
126-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_TimeTravel, Mixin_RandomSample}
127126

128127
def explain_as_text(self, query: str) -> str:
129128
return f"EXPLAIN USING TEXT {query}"

data_diff/databases/vertica.py

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class Dialect(
9898
# Boolean
9999
"boolean": Boolean,
100100
}
101-
MIXINS = {Mixin_Schema, Mixin_MD5, Mixin_NormalizeValue, Mixin_RandomSample}
102101

103102
def quote(self, s: str):
104103
return f'"{s}"'

tests/test_database.py

-4
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ def test_connect_to_db(self):
4545

4646
class TestMD5(unittest.TestCase):
4747
def test_md5_as_int(self):
48-
class MD5Dialect(dbs.mysql.Dialect, dbs.mysql.Mixin_MD5):
49-
pass
50-
5148
self.mysql = connect(TEST_MYSQL_CONN_STRING)
52-
self.mysql.dialect = MD5Dialect()
5349

5450
str = "hello world"
5551
query_fragment = self.mysql.dialect.md5_as_int("'{0}'".format(str))

tests/test_query.py

-3
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ def set_timezone_to_utc(self) -> str:
6666
def optimizer_hints(self, s: str):
6767
return f"/*+ {s} */ "
6868

69-
def load_mixins(self):
70-
raise NotImplementedError()
71-
7269
parse_type = NotImplemented
7370

7471

0 commit comments

Comments
 (0)