Class SchematizationUtils
- java.lang.Object
-
- com.snowflake.kafka.connector.internal.streaming.SchematizationUtils
-
public class SchematizationUtils extends Object
This is a class containing the helper functions related to schematization
-
-
Constructor Summary
Constructors Constructor Description SchematizationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidevolveSchemaIfNeeded(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 evolutionstatic StringformatName(String objectName)Transform the objectName to uppercase unless it is enclosed in double quotes
-
-
-
Method Detail
-
formatName
public static String formatName(String objectName)
Transform the objectName to uppercase unless it is enclosed in double quotesIn 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 SnowflaketableName- table namenonNullableColumns- a list of columns that needs to update the nullabilityextraColNames- a list of columns that needs to be updatedrecord- the sink record that contains the schema and actual data
-
-