Skip to content

Schema Evolution not working #141

@rajshtech

Description

@rajshtech

Hello,

I am replicating the table from MySql to ClickHouse in real time sync process. I have altered the table by adding new column, but the Schema changes are not replicated to the ClickHouse table and running without fail. When I inserted a value to that column and failed with list index out of range as below. Then I deleted the state.pckl file, for which it started replication from scratch.

File "/home/anaconda/miniconda3/envs/mysql_ch_repli/lib/python3.11/site-packages/mysql_ch_replicator/converter.py", line 439, in convert_record
mysql_field_type = mysql_field_types[idx]
~~~~~~~~~~~~~~~~~^^^^^
IndexError: list index out of range

Similarly, for other cases like rename, drop column, modify datatype.

Please let me know if anything missing for schema evolution config.

Another Scenario: Dropped a column and added values to the existing columns, then failed with below error.

File "/home/anaconda/miniconda3/envs/mysql_ch/lib/python3.12/site-packages/clickhouse_connect/driver/insert.py", line 94, in data
raise ProgrammingError('Insert data column count does not match column names')
clickhouse_connect.driver.exceptions.ProgrammingError: Insert data column count does not match column names

Here is the config file using to run the replicator:

'mysql':
host: 'localhost'
port: 8306
user: 'root'
password: 'root'
clickhouse:
host: 'localhost'
port: 8323
user: 'default'
password: 'default'
binlog_replicator:
data_dir: '/home/user/binlog/'
records_per_file: 100000
databases: 'intranet'
tables: ['table_name']
target_databases:
mysql_db_name: clickhouse_db_name
log_level: 'info'

Environment Information
mysql_ch_replicator version: v0.0.73
MySQL version: 8.0.32
ClickHouse version: 25.3.2.39
Python version: Python 3.11.9 on linux

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions