Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mysql_ch_replicator/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def convert_type(self, mysql_type):
return 'String'
if 'varchar' in mysql_type:
return 'String'
if 'text' in mysql_type:
return 'String'
if 'blob' in mysql_type:
return 'String'
if 'char' in mysql_type:
return 'String'
if 'json' in mysql_type:
Expand Down
10 changes: 9 additions & 1 deletion test_mysql_ch_replicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ def test_e2e_regular():
id int NOT NULL AUTO_INCREMENT,
name varchar(255),
age int,
field1 text,
field2 blob,
PRIMARY KEY (id)
);
''')

mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES ('Ivan', 42);", commit=True)
mysql.execute(
f"INSERT INTO {TEST_TABLE_NAME} (name, age, field1, field2) VALUES ('Ivan', 42, 'test1', 'test2');",
commit=True,
)
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES ('Peter', 33);", commit=True)

binlog_replicator_runner = BinlogReplicatorRunner()
Expand All @@ -120,6 +125,9 @@ def test_e2e_regular():
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 4)
assert_wait(lambda: ch.select(TEST_TABLE_NAME, where="name='Mary'")[0]['last_name'] == 'Smith')

assert_wait(lambda: ch.select(TEST_TABLE_NAME, where="field1='test1'")[0]['name'] == 'Ivan')
assert_wait(lambda: ch.select(TEST_TABLE_NAME, where="field2='test2'")[0]['name'] == 'Ivan')


mysql.execute(
f"ALTER TABLE {TEST_DB_NAME}.{TEST_TABLE_NAME} "
Expand Down
Loading