rusuly / MySqlCdc

MySQL/MariaDB binlog replication client for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get the cells column name?

yang-xiaodong opened this issue · comments

Hello, this is a great library~

I know that the column name is not included in the raw event data, but I need using the clolumn name to get the data from cells, so I want to ask that is there some way to get the affected column names?

Thanks.

My database is MariaDB 10.3

Hello,

MariaDB was branched from MySQL 5.5 which doesn't include column names(or any column identifiers) in binary log.
Column names metadata was added later in MySQL 5.6 and wasn't included in MariaDB.
The only way as I see it to get column names in MariaDB is to retrieve them using SQL query like this:

    select TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION
    from INFORMATION_SCHEMA.COLUMNS
    where TABLE_NAME='AspNetUsers' and TABLE_SCHEMA='Identity'
    order by ORDINAL_POSITION;

The query result will show columns in the same order as they are logged in the binlog

Thanks for your quick reply, I got it.

Is there any plan to provide a easily API to get column names in the future versions, I think MySqlCdc
can execute the sql queries and cache it, maybe also need to update the cache when column changed, what do you think? this is just a suggestion

This is a good idea, but I think the library should be a low-level connector. I think that for high-level API with caching features there has to be a separate library that uses MySqlCdc. Different companies may have different use cases

If the goal of MySqlCdc is low-level connector, I definitely agree with you~

Thanks again, cheers~

My pleasure,
Basically, the lib serves the same purpose as mysql-binlog-connector-java
We should make it more flexible but high-level API should be implemented by specific companies/libraries per their needs.
Feel free to provide feedback.

This is a really reasonable question.
Maybe the lib should support it, but definitely not in v1,
In first version I'm going to include low-level things like SSL encryption, replication

Looks like table metadata will be supported in MariaDB 10.5 when it is released
See binlog_row_metadata

I really hope to have it .

My pleasure,
Basically, the lib serves the same purpose as mysql-binlog-connector-java
We should make it more flexible but high-level API should be implemented by specific companies/libraries per their needs.
Feel free to provide feedback.

I really hope to have it .