Target Options
Specification
Here we have various keys accepted for target options:
add_new_columns
(Only for database target)
Whether to add new columns from stream not found in target table (when mode is not full-refresh
). Default is true
.
adjust_column_type
(Only for database target)
Whether to adjust the column type when needed. Default is false
. [BETA]
batch_limit
(Only for database target — since v1.2.11)
The maximum number of records per transaction batch.
column_casing
Whether to convert the column name casing. This facilitates querying tables in target database without using quotes. Accepts source
(keep original casing), target
(converts casing according to target database), snake
(converts snake casing according to target database), upper
or lower
. Default is source
.
compression
(Only for file target)
The type of compression to use when writing files. Valid inputs are none
, auto
and gzip
, zstd
, snappy
. Default is auto
.
datetime_format
(Only for file target)
delimiter
(Only for file target)
The delimiter to use when writing tabular files. Default is ,
.
file_max_bytes
(Only for file target)
The maximum number of bytes to write to a file. 0
means infinite number of bytes. When a value greater than 0
is specified, the output location will be a folder with many parts in it. Default is 16000000
. Does not work with parquet
file format (use file_max_rows
instead).
file_max_rows
(Only for file target)
The maximum number of rows (usually lines) to write to a file. 0
means infinite number of rows. When a value greater than 0
is specified, the output location will be a folder with many parts in it. Default is 500000
.
format
(Only for file target)
The format of the file(s). Options are: csv
, parquet
, xlsx
, json
and jsonlines
.
ignore_existing
Ignore existing target file/table if it exists (do not overwrite/modify). Default is false
.
header
(Only for file target)
Whether to write the first line as header. Default is true
.
post_sql
(Only for database target)
The SQL query to run after loading.
pre_sql
(Only for database target)
The SQL query to run before loading.
table_ddl
(Only for database target)
table_keys
(Only for database target)
table_tmp
(Only for database target)
The temporary table name that should be used when loading into a database. Default is auto-generated by Sling.
use_bulk
(Only for database target)
Table DDL
The table_ddl
option allows you to define the table DDL to use when creating a table. This is useful when you want to define a table with specific properties. Sling also allows the injection of runtime variables, such as {stream_table}
, which will be replaced with the actual stream table name. See Runtime Variables for more information. The special {col_types}
variable will be replaced with the actual column types of the stream table.
Here is an example of using the table_ddl
option:
Table Keys
Table keys are used to define the keys of the target table. They are useful to preset keys such as indexes, primary keys, etc.
Here are the accepted keys:
cluster
(used in BigQuery and Snowflake)index
(used in PostgreSQL, MySQL, Oracle, SQL Server, SQLite and DuckDB)partition
(used in PostgreSQL, BigQuery, ClickHouse)primary
(used in PostgreSQL, MySQL, Oracle, SQL Server, SQLite)sort
(used in Redshift)unique
(used in PostgreSQL, MySQL, Oracle, SQL Server, SQLite and DuckDB)aggregate
,duplicate
,distribution
andhash
(used in StarRocks)
Here is an example of using the table_keys
option:
Last updated