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

[FLINK-33761][Connector/JDBC] Add Snowflake JDBC Dialect #118

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

Conversation

borislitvak
Copy link

@borislitvak borislitvak commented Apr 30, 2024

Feature: New JBDC connector dialect - connect to Snowflake.

Testing: As Snowflake is a SAAS offering, I did not provide any tests for it. We don't want to incur any more expenses. Note that it's a new feature. Any potential breakages in this PR should not impact existing users.

Usage Example: This is how I use it in my sample code:

    public static Table getSnowflakeTable(StreamTableEnvironment tEnv, SnowflakeConfig config) {
        tEnv.createTemporaryTable(
                "XXX",
                TableDescriptor.forConnector("jdbc")
                        .schema(Schema.newBuilder()
                                .column("F1", DataTypes.BIGINT())
                                .column("F2", DataTypes.TIMESTAMP().bridgedTo(java.time.LocalDateTime.class))
                                .build()
                        )
                        .option("driver", config.getDriver())
                        // https://docs.snowflake.com/developer-guide/jdbc/jdbc-configure#connection-parameters
                        .option("url", config.getUrl() + "&CLIENT_TIMESTAMP_TYPE_MAPPING=TIMESTAMP_NTZ")
                        .option("table-name", "Snowflake-Sample-Table-Replace-This")
                        .build()
        );
        return tEnv.sqlQuery("SELECT * FROM XXX");
    }

Copy link

boring-cyborg bot commented Apr 30, 2024

Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)

@borislitvak
Copy link
Author

@davidradl WDYT?

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

Successfully merging this pull request may close these issues.

3 participants