Redshift Bulk Loader
DescriptionThe Redshift Bulk Loader transform loads data from Apache Hop to AWS Redshift using the
|
| The Redshift Bulk Loader is linked to the database type. It will fetch the JDBC driver from the hop/lib/jdbc folder. |
+
General Options
| Option | Description |
|---|---|
Transform name | Name of the transform. |
Connection | Name of the database connection on which the target table resides. |
Target schema | The name of the target schema to write data to. |
Target table | The name of the target table to write data to. |
AWS Authentication | choose which authentication method to use with the
|
Use AWS system variables | ( |
AWS_ACCESS_KEY_ID | (if |
AWS_SECRET_ACCESS_KEY | (if |
IAM Role | (if |
Truncate table | Truncate the target table before loading data. |
Truncate on first row | Truncate the target table before loading data, but only when a first data row is received (will not truncate when a pipeline runs an empty stream (0 rows)). |
Specify database fields | Specify the database and stream fields mapping |
Main Options
| Option | Description |
|---|---|
Stream to S3 CSV | write the current pipeline stream to a CSV file in an S3 bucket before performing the |
Load from existing file | do not stream the contents of the current pipeline, but perform the |
Copy into Redshift from existing file | path to the file in S3 to |
The staging file
When Stream to S3 CSV is enabled the transform writes the CSV named under Copy into Redshift from file name/path itself, and creates the folder it goes in when that does not exist yet. This matters on S3, where a prefix only exists for as long as an object sits under it: a brand new path would otherwise be refused before a single row was written.
JSON and SUPER columns
A JSON field is written to the CSV file enclosed and escaped, the same as any text that could otherwise break the row — JSON is full of commas and quotes, and Apache Hop pretty prints it across several lines by default.
COPY parses the field into a real SUPER object, so JSON_TYPEOF(payload) returns object once the value has loaded.
Two things surprise people when reading it back:
-
payload::varcharon aSUPERobject isNULL. UseJSON_SERIALIZE(payload)to get the JSON text. -
Redshift folds unquoted
SUPERattribute names to lower case unlessenable_case_sensitive_super_attributeis on, sopayload.myFielddoes not match a camelCase key — and quoting the attribute does not help while that setting is off.
Addressing the value as text sidesteps both:
SELECT JSON_EXTRACT_PATH_TEXT(JSON_SERIALIZE(payload), 'myField') FROM my_table; Dates and timestamps
Date and timestamp fields are written to the CSV file as ISO 8601 with milliseconds, yyyy-MM-dd HH:mm:ss.SSS, and the COPY statement declares DATEFORMAT AS 'auto' and TIMEFORMAT AS 'auto' to read them back. auto is used because the explicit TIMEFORMAT patterns have no token for fractional seconds.
An Apache Hop Date carries a time of day just as a Timestamp does, so both are written whole and the target column decides what to keep: a TIMESTAMP column keeps the time, a DATE column truncates it.