From 6f7f5fdbe47ae0524300476bd1d499e76b7c3492 Mon Sep 17 00:00:00 2001 From: Filipp Ozinov Date: Sat, 30 Nov 2024 15:00:39 +0400 Subject: [PATCH 1/2] Ignore fulltext key --- mysql_ch_replicator/clickhouse_api.py | 1 - mysql_ch_replicator/converter.py | 2 ++ test_mysql_ch_replicator.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mysql_ch_replicator/clickhouse_api.py b/mysql_ch_replicator/clickhouse_api.py index 011bc4a..ffe34b3 100644 --- a/mysql_ch_replicator/clickhouse_api.py +++ b/mysql_ch_replicator/clickhouse_api.py @@ -119,7 +119,6 @@ def create_table(self, structure: TableStructure, additional_indexes: list | Non 'partition_by': partition_by, 'indexes': indexes, }) - print(" === query:", query) self.execute_command(query) def insert(self, table_name, records, table_structure: TableStructure = None): diff --git a/mysql_ch_replicator/converter.py b/mysql_ch_replicator/converter.py index b762777..b9b7273 100644 --- a/mysql_ch_replicator/converter.py +++ b/mysql_ch_replicator/converter.py @@ -520,6 +520,8 @@ def parse_mysql_table_structure(self, create_statement, required_table_name=None continue if line.lower().startswith('constraint'): continue + if line.lower().startswith('fulltext'): + continue if line.lower().startswith('primary key'): # Define identifier to match column names, handling backticks and unquoted names identifier = (Suppress('`') + Word(alphas + alphanums + '_') + Suppress('`')) | Word( diff --git a/test_mysql_ch_replicator.py b/test_mysql_ch_replicator.py index 3b9999c..589709a 100644 --- a/test_mysql_ch_replicator.py +++ b/test_mysql_ch_replicator.py @@ -315,6 +315,8 @@ def test_runner(): name varchar(255), age int, rate decimal(10,4), + KEY `IDX_age` (`age`), + FULLTEXT KEY `IDX_name` (`name`), PRIMARY KEY (id) ); ''') From 37a993c5efbbed61226a03ee4281f057222a0809 Mon Sep 17 00:00:00 2001 From: Filipp Ozinov Date: Sat, 30 Nov 2024 15:01:57 +0400 Subject: [PATCH 2/2] Use debug instead of print --- mysql_ch_replicator/clickhouse_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql_ch_replicator/clickhouse_api.py b/mysql_ch_replicator/clickhouse_api.py index ffe34b3..510a368 100644 --- a/mysql_ch_replicator/clickhouse_api.py +++ b/mysql_ch_replicator/clickhouse_api.py @@ -119,6 +119,7 @@ def create_table(self, structure: TableStructure, additional_indexes: list | Non 'partition_by': partition_by, 'indexes': indexes, }) + logger.debug(f'create table query: {query}') self.execute_command(query) def insert(self, table_name, records, table_structure: TableStructure = None):