Connector configuration reference¶

Database objects and procedures¶

The following database objects are created through the file configuration/connector_configuration.sql.

PUBLIC.CONFIGURE_CONNECTOR (config VARIANT)¶

Entry point procedure available to the ADMIN role. This procedure invokes the Java function ConfigureConnectorHandler.configureConnector.

PUBLIC.CONFIGURE_CONNECTOR_VALIDATE (config VARIANT)¶

Procedure used for connector specific validation of the configuration. By default, it returns 'response_code': 'OK'. It is invoked by the DefaultConfigureConnectorInputValidator function. Can be overwritten both in SQL and Java.

PUBLIC.CONFIGURE_CONNECTOR_INTERNAL (config VARIANT)¶

Procedure used for connector specific additional configuration. By default, it returns 'response_code': 'OK'. It is invoked by the InternalConfigureConnectorCallback. Can be overwritten both in SQL and Java.

Custom handler¶

Handler and its internals can be customized using the following two approaches.

Procedure replacement approach¶

The following components can be replaced using SQL.

Handler¶

To provide whole custom implementation of the ConfigureConnectorHandler the PUBLIC.CONFIGURE_CONNECTOR procedure must be replaced. For example:

CREATE OR REPLACE PROCEDURE PUBLIC.CONFIGURE_CONNECTOR(config VARIANT)
RETURNS VARIANT
LANGUAGE JAVA
RUNTIME_VERSION = '11'
PACKAGES = ('com.snowflake:snowpark:1.11.0')
IMPORTS = ('/connectors-native-sdk.jar')
HANDLER = 'com.custom.handler.CustomConfigureConnectorHandler.configureConnector';

GRANT USAGE ON PROCEDURE PUBLIC.CONFIGURE_CONNECTOR(VARIANT) TO APPLICATION ROLE ADMIN;
Copy

Internal procedures¶

Internal VALIDATE and INTERNAL procedures can be also customized through the SQL. They can even invoke another Java handler:

CREATE OR REPLACE PROCEDURE PUBLIC.CONFIGURE_CONNECTOR_INTERNAL(config VARIANT)
RETURNS VARIANT
LANGUAGE SQL
EXECUTE AS OWNER
AS
BEGIN
    -- SOME CUSTOM LOGIC BEGIN
    SELECT sysdate();
    -- SOME CUSTOM LOGIC END

    RETURN OBJECT_CONSTRUCT('response_code', 'OK');
END;

CREATE OR REPLACE PROCEDURE PUBLIC.CONFIGURE_CONNECTOR_VALIDATE(config VARIANT)
    RETURNS VARIANT
    LANGUAGE JAVA
    RUNTIME_VERSION = '11'
    PACKAGES = ('com.snowflake:snowpark:1.11.0')
    IMPORTS = ('/connectors-native-sdk.jar')
    HANDLER = 'com.custom.handler.CustomConfigureConnectorInternalHandler.configureConnector';
Copy

Builder approach¶

ConfigureConnectorHandler can be customized using ConfigureConnectorHandlerBuilder. This builder allows user to provide custom implementations of the following interfaces:

In case one of them is not provided the default implementation provided by the SDK will be used.

class CustomConfigureConnectorInputValidator implements ConfigureConnectorInputValidator {
    @Override
    public ConnectorResponse validate(Variant config) {
        // CUSTOM LOGIC
        return ConnectorResponse.success();
    }
}

class CustomHandler {

    // Path to this method needs to be specified in the PUBLIC.CONFIGURE_CONNECTOR procedure using SQL
    public static Variant configureConnector(Session session, Variant configuration) {
            //Using builder
        var handler = ConfigureConnectorHandler.builder(session)
            .withInputValidator(new CustomConfigureConnectorInputValidator())
            .build();
        return handler.configureConnector(configuration).toVariant();
    }
}
Copy