Class SchematizationUtils


  • public class SchematizationUtils
    extends Object
    This is a class containing the helper functions related to schematization
    • Constructor Detail

      • SchematizationUtils

        public SchematizationUtils()
    • Method Detail

      • formatName

        public static String formatName​(String objectName)
        Transform the objectName to uppercase unless it is enclosed in double quotes

        In that case, drop the quotes and leave it as it is.

        Parameters:
        objectName - name of the snowflake object, could be tableName, columnName, roleName, etc.
        Returns:
        Transformed objectName
      • evolveSchemaIfNeeded

        public static void evolveSchemaIfNeeded​(@Nonnull
                                                SnowflakeConnectionService conn,
                                                String tableName,
                                                List<String> nonNullableColumns,
                                                List<String> extraColNames,
                                                org.apache.kafka.connect.sink.SinkRecord record)
        Execute a ALTER TABLE command if there is any extra column that needs to be added, or any column nullability that needs to be updated, used by schema evolution
        Parameters:
        conn - connection to the Snowflake
        tableName - table name
        nonNullableColumns - a list of columns that needs to update the nullability
        extraColNames - a list of columns that needs to be updated
        record - the sink record that contains the schema and actual data