To perform structured query language (SQL) operations in Amazon® Redshift®, add a step in a chain that uses an Amazon Redshift connection command.
To enable these commands, an IT admin first creates an Amazon Redshift connector.
Execute Create
Executes a CREATE
statement
Inputs
Input |
Detail |
SQL Text/File |
Enter the SQL text or file to execute |
Outputs
Output |
Output Type |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |
Execute Query
Executes a SELECT
query, and receive the results as a comma-separated values (CSV) file
Inputs
Input |
Detail |
SQL Text/File |
Enter the SQL text or file to execute |
Delimiter |
Select the delimiter to use for the CSV file output |
Preview Results |
For a preview of the returned rows, check this box |
Outputs
Output |
Output Type |
Record Count |
Integer |
Result Set (CSV) |
File |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |
Execute SQL
Executes any SQL command. If there is a result set, it will be available as a file output.
Inputs
Input |
Detail |
SQL Text/File |
Enter the SQL text or file to execute |
Outputs
Output |
Output Type |
Record Count |
Integer |
Result Set (CSV) |
File |
Records Updated |
Integer |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |
Execute Update
Executes an UPDATE
statement
Inputs
Input |
Detail |
SQL Text/File |
Enter the SQL text or file to execute |
Outputs
Output |
Output Type |
Records Updated |
Integer |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |
Get Table Definition
Retrieves the details of a table—including its columns, primary keys, and foreign keys—as JSON
Inputs
Input |
Detail |
Table |
Enter the table to retrieve the definition of |
Outputs
Output |
Output Type |
Table Metadata |
File |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |
Insert Records
Executes an INSERT
statement
Inputs
Input |
Detail |
Table |
Enter the table to insert records into |
CSV Data Source |
Enter the multi-lined text or CSV file to insert into the table. The columns in this data source must match the same order as the Columns input. |
Delimiter |
Select the delimiter used in the CSV Data Source input |
Is a File |
If the CSV Data Source input is a file, check this box |
Includes Headers |
If the first row of the CSV Data Source input is its headers, check this box |
Columns |
Enter the list of columns that the CSV Data Source input will populate. The order must be the same as the CSV Data Source input. |
Value Template |
Enter the custom values for the INSERT statement. Indicate values with a ? . The number of ? s should match the number of fields in the target. To auto-generate, leave blank. |
Outputs
Output |
Output Type |
Records Inserted |
Integer |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |
Upsert Records
Executes an UPSERT
statement. If the unique keys of an existing record match those of a record in the data source, the command updates the record; otherwise, it inserts the record.
Inputs
Input |
Detail |
Target Table |
Enter the table to upsert records into |
Staging Table (Auto-generated) |
Enter the name of the table to temporarily hold records as they upsert in the target table
Note: Do not use an existing table; the command automatically creates and then drops this table during the upsert.
|
Unique Columns |
Enter a list of the columns that contain unique values for each record. If these columns match between records in both the staging and target tables, the command updates the record; otherwise, it inserts the record. |
CSV Data Source |
Enter the multi-lined text or CSV file to upsert into the target table. The columns in this data source must match the same order as the Columns input. |
Delimiter |
Select the delimiter used in the CSV Data Source input |
Is a File |
If the CSV Data Source input is a CSV file, check this box |
Includes Headers |
If the CSV Data Source input starts with a header row, check this box |
Columns |
Enter the list of columns that the CSV Data Source input will populate. The order must be the same as the CSV Data Source input. |
Value Template |
Enter the custom values for the UPSERT statement. Indicate values with a ? . The number of ? s should match the number of fields in the target. To auto-generate, leave blank. |
Outputs
Output |
Output Type |
Records Upserted |
Integer |
SQL Error |
JSON |
Exit Codes
Code |
Type |
Detail |
0 |
Success |
Success |
1 |
Error |
Invalid inputs were given |
3 |
Error |
Failed to run the command |