julien-duponchelle/python-mysql-replication

Mitigate Column Schema Retrieval Issue for Older MySQL Versions using DDL Parsing

dongwook-chan opened this issue · 0 comments

Description:
python-mysql-replication currently fetches column schema using the information_schema. As part of our improvements, we are transitioning to utilizing the optional metadata of the table map event to retrieve column names. However, this optional metadata is not present in versions of MySQL prior to its introduction.

Problem:
For versions of MySQL that predate the introduction of optional metadata in the table map event, we face a challenge in retrieving the column schema.

Proposed Solution:
To address this, we suggest parsing DDL statements. By intercepting and analyzing DDL statements that alter tables (like ALTER TABLE, CREATE TABLE), we can track changes in column_schema and subsequently apply these changes to our table map. This would allow us to maintain an up-to-date representation of the table structure even without relying on information_schema or the optional metadata.

Benefits:
Ensures compatibility and functionality for older MySQL versions.
Provides a robust mechanism to track table schema changes.
Reduces the dependency on information_schema which could lead to performance benefits.
Requesting feedback and thoughts on this proposed solution to ensure we cater to all MySQL versions effectively.