Data mapping
The sink connector requires knowledge of schemas, so you should use a suitable converter (for example, the Avro converter that comes with Schema Registry or the JSON converter with schemas enabled).
If present, Kafka record keys can be primitive types or a Connect struct. The record value must be a Connect struct.
Fields being selected from Connect structs must be of primitive types.
If the data in the topic is not of a compatible format, implementing a custom Converter
may be necessary.
Key handling
The default is for primary keys to not be extracted with pk.mode
set to
none
. This is not suitable when the connector is responsible for
auto-creating the destination table. There are different modes that can be
enabled to use fields from the Kafka record key, the Kafka record value, or the
Kafka coordinates for the record. Refer to primary key configuration options for additional information.
Auto-creation and Auto-evolution
Note
The Teradata user requires CREATE TABLE
permissions for this feature.
If auto.create
is enabled, the connector can CREATE the destination table if it is found to be missing.
The creation takes place online with records being consumed from the topic, since the connector uses the record schema as a basis for the table definition.
Primary keys are specified based on the key configuration settings.
If auto.evolve
is enabled, the connector can perform limited auto-evolution by issuing ALTER on the destination table when it encounters a record for which a column is found to be missing.
Since data-type changes and removal of columns can be dangerous, the connector does not attempt to perform such evolutions on the table.
Addition of primary key constraints is also not attempted. In contrast, if auto.evolve
is disabled, no evolution is performed and the connector task fails with a missing columns error.
For both auto-creation and auto-evolution, the nullability of a column is based
on the optionality of the corresponding field in the schema. Default values are
also specified based on the default value of the corresponding field (if
applicable). We use the following mapping from Connect schema types to Teradata
types:
Schema Type |
Teradata |
INT8 |
BYTEINT |
INT16 |
SMALLINT |
INT32 |
INTEGER |
INT64 |
BIGINT |
FLOAT32 |
FLOAT |
FLOAT64 |
DOUBLE PRECISION |
BOOLEAN |
BYTEINT |
STRING |
LONG VARCHAR CHARACTER SET UNICODE |
BYTES |
VARBYTES(64000) |
‘Decimal’ |
DECIMAL(38,s) |
‘Date’ |
DATE |
‘Time’ |
TIME WITH TIME ZONE |
‘Timestamp’ |
TIMESTAMP WITH TIME ZONE |
Important
For backwards-compatible table schema evolution, new fields in record
schemas must be optional or have a default value. If you need to delete a
field, the table schema should be manually altered to either drop the
corresponding column, assign it a default value, or make it nullable.