Skip to content

Commit 6bf2226

Browse files
committed
More tests and fixes
1 parent bd0a3d4 commit 6bf2226

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

mysql_ch_replicator/clickhouse_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def insert(self, table_name, records, table_structure: TableStructure = None):
135135
try:
136136
e.timestamp()
137137
except (ValueError, AttributeError):
138-
e = 0
138+
e = datetime.datetime(1970, 1, 1)
139139
new_record.append(e)
140140
record = new_record
141141

test_mysql_ch_replicator.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,13 @@ def test_datetime_exception():
481481

482482
assert_wait(lambda: TEST_TABLE_NAME in ch.get_tables())
483483
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 1)
484+
485+
mysql.execute(
486+
f"INSERT INTO {TEST_TABLE_NAME} (name, modified_date) VALUES ('Alex', '0000-00-00 00:00:00');",
487+
commit=True,
488+
)
489+
mysql.execute(
490+
f"INSERT INTO {TEST_TABLE_NAME} (name, modified_date) VALUES ('Givi', '2023-01-08 03:11:09');",
491+
commit=True,
492+
)
493+
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 3)

0 commit comments

Comments
 (0)