Last updated
Last updated
Not in the traditional sense. However, Sling is capable of the below transforms.
Here is a list of built-in transforms that Sling can perform:
decode_latin1
: Decodes Latin-1 (ISO-8859-1) encoded text to UTF-8
decode_latin5
: Decodes Latin-5 (ISO-8859-5) encoded text to UTF-8
decode_latin9
: Decodes Latin-9 (ISO-8859-15) encoded text to UTF-8
decode_utf8
: Decodes UTF-8 encoded text
decode_utf8_bom
: Decodes UTF-8 with BOM encoded text
decode_utf16
: Decodes UTF-16 encoded text to UTF-8
decode_windows1250
: Decodes Windows-1250 encoded text to UTF-8
decode_windows1252
: Decodes Windows-1252 encoded text to UTF-8
duckdb_list_to_text
: Adds a space suffix to DuckDB lists to prevent JSON parsing errors
encode_latin1
: Encodes text to Latin-1 (ISO-8859-1)
encode_latin5
: Encodes text to Latin-5 (ISO-8859-5)
encode_latin9
: Encodes text to Latin-9 (ISO-8859-15)
encode_utf8
: Encodes text to UTF-8
encode_utf8_bom
: Encodes text to UTF-8 with BOM
encode_utf16
: Encodes text to UTF-16
encode_windows1250
: Encodes text to Windows-1250
encode_windows1252
: Encodes text to Windows-1252
hash_md5
: Generates MD5 hash of the input
hash_sha256
: Generates SHA-256 hash of the input
hash_sha512
: Generates SHA-512 hash of the input
parse_bit
: Parses binary data as bits
parse_fix
: Parses FIX (Financial Information eXchange) protocol messages into JSON format
parse_uuid
: Parses 16-byte UUID into string format
parse_ms_uuid
: Parses 16-byte Microsoft UUID into string format
replace_0x00
: Replaces null characters (0x00) with an empty string
replace_accents
: Replaces accented characters with their non-accented equivalents
replace_non_printable
: Replaces or removes non-printable characters
trim_space
: Removes leading and trailing whitespace
empty_as_null
: If value is empty, set as null
set_timezone
(v1.2.16): Sets the timezone for datetime values. Accepts the timezone string (e.g. "America/New_York")
Examples using the CLI
Examples using a replication.yaml
Custom SELECT
query as the source stream, using a custom SQL input as a source.stream
. Here is an example::
See below for a simple example, mimicking the addition and removal of columns.
We can see that sling handled the changes properly, in a non-destructive manner. If the source stream were from a database, the same rules would apply, whether a column disappeared or appeared.
There are currently no plans to support other custom transformations.
JSON Flattening: the flatten
key in source.options (see ). Example:
transformations for JSON source files: the jmespath
key in source.options
. Here is a example, extracting the models information from the DBT manifest file using jmespath
+ flatten
options:
When using Sling to extract/load data in a manner, it will attempt to match whatever columns are present in both the source stream and target table. If an extra column is present in the source stream, it will add it in the target table. If no columns match from source stream at all, it will error. At least the primary_key
or update_key
must be present in the target table.
Using Sling transforms