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

Commit d7ad7c4

Browse files
committed
cleanup
1 parent 8e3084b commit d7ad7c4

File tree

5 files changed

+15
-30
lines changed

5 files changed

+15
-30
lines changed

data_diff/sqeleton/databases/base.py

-2
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,6 @@ def _query_cursor(self, c, sql_code: str) -> QueryResult:
527527
if sql_code.lower().startswith(("select", "explain", "show")):
528528
columns = [col[0] for col in c.description]
529529

530-
# TODO FIXME pyodbc.Row seems to be causing a pydantic error
531-
# [ConstantTable] Attribute 'rows' expected value of type Sequence[Sequence[Any]]
532530
fetched = c.fetchall()
533531
result = QueryResult(fetched, columns)
534532
return result

data_diff/sqeleton/databases/mssql.py

-9
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ def import_mssql():
3535

3636

3737
class Mixin_NormalizeValue(AbstractMixin_NormalizeValue):
38-
# TODO FIXME the output in this method seems correct but timestamp precision isn't
39-
# being properly concatenated in tests
4038
def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
4139
if coltype.precision > 0:
4240
formatted_value = (
@@ -57,11 +55,6 @@ def normalize_number(self, value: str, coltype: FractionalType) -> str:
5755

5856
class Mixin_MD5(AbstractMixin_MD5):
5957
def md5_as_int(self, s: str) -> str:
60-
# TODO FYI
61-
# I didn't see another way to do this
62-
# keep in mind this also required reducing
63-
# CHECKSUM_HEXDIGITS = 15 -> 14 due to the convert needing an even number of hex digits
64-
# (affects all dbs)
6558
return f"convert(bigint, convert(varbinary, '0x' + RIGHT(CONVERT(NVARCHAR(32), HashBytes('MD5', {s}), 2), {CHECKSUM_HEXDIGITS}), 1))"
6659

6760

@@ -168,8 +161,6 @@ class MsSQL(ThreadedDatabase):
168161
def __init__(self, host, port, user, password, *, database, thread_count, **kw):
169162
args = dict(server=host, port=port, database=database, user=user, password=password, **kw)
170163
self._args = {k: v for k, v in args.items() if v is not None}
171-
172-
# TODO User supplied value?
173164
self._args["driver"] = "{ODBC Driver 18 for SQL Server}"
174165

175166
# TODO temp dev debug

tests/common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
N_SAMPLES = int(os.environ.get("N_SAMPLES", DEFAULT_N_SAMPLES))
4343
BENCHMARK = os.environ.get("BENCHMARK", False)
4444
N_THREADS = int(os.environ.get("N_THREADS", 1))
45-
# TODO temp dev
46-
TEST_ACROSS_ALL_DBS = os.environ.get("TEST_ACROSS_ALL_DBS", "full") # Should we run the full db<->db test suite?
45+
TEST_ACROSS_ALL_DBS = os.environ.get("TEST_ACROSS_ALL_DBS", True) # Should we run the full db<->db test suite?
4746

4847

4948
def get_git_revision_short_hash() -> str:

tests/sqeleton/test_database.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,33 @@
77
from data_diff.sqeleton import connect
88
from data_diff.sqeleton import databases as dbs
99
from data_diff.sqeleton.queries import table, current_timestamp, NormalizeAsString
10-
from tests.common import TEST_MYSQL_CONN_STRING, TEST_MSSQL_CONN_STRING
10+
from tests.common import TEST_MYSQL_CONN_STRING
1111
from tests.sqeleton.common import str_to_checksum, test_each_database_in_list, get_conn, random_table_suffix
1212
from data_diff.sqeleton.abcs.database_types import TimestampTZ
1313

1414
TEST_DATABASES = {
15-
# TODO dev
16-
# dbs.MySQL,
17-
# dbs.PostgreSQL,
18-
# dbs.Oracle,
19-
# dbs.Redshift,
20-
# dbs.Snowflake,
21-
# dbs.DuckDB,
22-
# dbs.BigQuery,
23-
# dbs.Presto,
24-
# dbs.Trino,
25-
# dbs.Vertica,
26-
dbs.MsSQL
15+
dbs.MySQL,
16+
dbs.PostgreSQL,
17+
dbs.Oracle,
18+
dbs.Redshift,
19+
dbs.Snowflake,
20+
dbs.DuckDB,
21+
dbs.BigQuery,
22+
dbs.Presto,
23+
dbs.Trino,
24+
dbs.Vertica,
25+
dbs.MsSQL,
2726
}
2827

2928
test_each_database: Callable = test_each_database_in_list(TEST_DATABASES)
3029

3130

3231
class TestDatabase(unittest.TestCase):
3332
def setUp(self):
34-
# TODO temp dev
35-
self.mssql = connect(TEST_MSSQL_CONN_STRING)
33+
self.mysql = connect(TEST_MYSQL_CONN_STRING)
3634

3735
def test_connect_to_db(self):
38-
self.assertEqual(1, self.mssql.query("SELECT 1", int))
36+
self.assertEqual(1, self.mysql.query("SELECT 1", int))
3937

4038

4139
class TestMD5(unittest.TestCase):

tests/test_database_types.py

-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ def init_conns():
353353
},
354354
db.MsSql: {
355355
"int": ["INT", "BIGINT"],
356-
# TODO precision is being truncated to 4 somewhere
357356
"datetime": ["datetime2(6)"],
358357
"float": ["DECIMAL(6, 2)", "FLOAT", "REAL"],
359358
"uuid": ["VARCHAR(100)", "CHAR(100)", "UNIQUEIDENTIFIER"],

0 commit comments

Comments
 (0)