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

Support column properties with jdbc connector #25174

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hqbhoho
Copy link
Contributor

@hqbhoho hqbhoho commented Feb 27, 2025

Description

Add column properties for base jdbc connector to support auto_increment, default value and other column attribute.
When running SHOW CREATE TABLE include column properties present for these column attribute.

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Mysql
*  Add support create table with auto increment column

@cla-bot cla-bot bot added the cla-signed label Feb 27, 2025
@hqbhoho hqbhoho marked this pull request as draft February 27, 2025 01:36
@github-actions github-actions bot added the mysql MySQL connector label Feb 27, 2025
@hqbhoho hqbhoho changed the title Feature/support column properties with jdbc connector Support column properties with jdbc connector Feb 27, 2025
Copy link

This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack.

@github-actions github-actions bot added the stale label Mar 20, 2025
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch 4 times, most recently from fb07f55 to 6e462ab Compare March 26, 2025 09:47
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch 4 times, most recently from c6bfe5f to 7309388 Compare March 26, 2025 13:21
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch from 7309388 to dbc00bb Compare March 26, 2025 14:02
@hqbhoho hqbhoho marked this pull request as ready for review March 26, 2025 15:08
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch from dbc00bb to 7630693 Compare March 26, 2025 16:01
@github-actions github-actions bot removed the stale label Mar 26, 2025
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch from 7630693 to dbc00bb Compare March 27, 2025 02:57
@hqbhoho
Copy link
Contributor Author

hqbhoho commented Mar 27, 2025

The JdbcColumnHandle may include all the information returned by DatabaseMetaData.getColumns()?
If we do not add additional fields to the JdbcColumnHandle, due to serialization constraints, it seems that we can only implement a JdbcExtraColumnHandle in the base-jdbc package and configure JsonTypeInfo like this:

@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        property = "@type")
@JsonSubTypes({
        @JsonSubTypes.Type(value = JdbcExtraColumnHandle.class, name = "system:io.trino.plugin.jdbc.JdbcExtraColumnHandle"),
        @JsonSubTypes.Type(value = JdbcColumnHandle.class, name = "system:io.trino.plugin.jdbc.JdbcColumnHandle")
})
public class JdbcColumnHandle
        implements ColumnHandle
{
}
public class JdbcExtraColumnHandle
        extends JdbcColumnHandle
{
    private final boolean autoIncrement;
    ...
}     

@chenjian2664 @ebyhr So which way is better?

@hqbhoho hqbhoho requested review from chenjian2664 and ebyhr and removed request for chenjian2664 March 27, 2025 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed mysql MySQL connector
Development

Successfully merging this pull request may close these issues.

1 participant