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

Commit 2e1ba41

Browse files
author
Sergey Vasilyev
committed
Simplify double-inheritance of Trino dialect from Presto dialect
All the Presto mixins are already inherited into the Trino dialect via its base class, so there is no need to duplicate the mixins.
1 parent 312a9c5 commit 2e1ba41

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

data_diff/databases/trino.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import attrs
44

5-
from data_diff.abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue
65
from data_diff.abcs.database_types import TemporalType, ColType_UUID
76
from data_diff.databases import presto
87
from data_diff.databases.base import import_helper
@@ -16,11 +15,9 @@ def import_trino():
1615
return trino
1716

1817

19-
Mixin_MD5 = presto.Mixin_MD5
20-
18+
class Dialect(presto.Dialect):
19+
name = "Trino"
2120

22-
@attrs.define(frozen=False)
23-
class Mixin_NormalizeValue(presto.Mixin_NormalizeValue):
2421
def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
2522
if coltype.rounds:
2623
s = f"date_format(cast({value} as timestamp({coltype.precision})), '%Y-%m-%d %H:%i:%S.%f')"
@@ -35,10 +32,6 @@ def normalize_uuid(self, value: str, coltype: ColType_UUID) -> str:
3532
return f"TRIM({value})"
3633

3734

38-
class Dialect(presto.Dialect, Mixin_MD5, Mixin_NormalizeValue, AbstractMixin_MD5, AbstractMixin_NormalizeValue):
39-
name = "Trino"
40-
41-
4235
@attrs.define(frozen=False, init=False, kw_only=True)
4336
class Trino(presto.Presto):
4437
dialect = Dialect()

0 commit comments

Comments
 (0)