Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the cells column name? #13

Closed
yang-xiaodong opened this issue Apr 11, 2020 · 8 comments
Closed

How to get the cells column name? #13

yang-xiaodong opened this issue Apr 11, 2020 · 8 comments

Comments

@yang-xiaodong
Copy link

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

@rusuly
Copy link
Owner

rusuly commented Apr 11, 2020

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

@yang-xiaodong
Copy link
Author

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

@rusuly
Copy link
Owner

rusuly commented Apr 11, 2020

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

@yang-xiaodong
Copy link
Author

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

Thanks again, cheers~

@rusuly
Copy link
Owner

rusuly commented Apr 11, 2020

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.

@rusuly
Copy link
Owner

rusuly commented Apr 11, 2020

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

@rusuly
Copy link
Owner

rusuly commented Apr 12, 2020

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

@songhejia
Copy link

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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants