AWS Redshift
With this integration you can query and modify data from your Redshift databases.
Official Websitehttps://aws.amazon.com/redshift/
TagsdatabaseSaas
JavaScript
Python
Documentationhttps://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-redshift-data/index.html
Version3.316.0
Documentationhttps://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift-data.html
Pypi packagehttps://pypi.org/project/boto3/
Version1.26.79
Source Codehttps://github.com/boto/boto3
Credential configuration
To fill the form params you need the Access key id
and the Secret access key
of the Programatic access
user you want to use. This user needs the permissions
to have access to Redshift to work properly. If you need to create the user,
you can see how to do it here.
In the extra options field you can pass any of the params you can find here.
Here you have an example of a filled credential configuration form in YepCode:

AWS Redshift snippets available in YepCode editor
note
The title is the triggering text for YepCode to autocomplete the script
JavaScript
Python
Integration
New integration from credential
const awsRedshiftClient = yepcode.integration.awsRedshift("credential-slug");
New integration from plain authentication data
const { RedshiftDataClient } = require("@aws-sdk/client-redshift-data");
const awsRedshiftClient = new RedshiftDataClient({
credentials: {
accessKeyId: "accessKeyId",
secretAccessKey: "secretAccessKey",
},
});
Execute statement
Execute statement
const { ExecuteStatementCommand } = require("@aws-sdk/client-redshift-data");
const executeStatementCommand = new ExecuteStatementCommand({
ClusterIdentifier: "clusterIdentifier",
Database: "database",
DbUser: "dbUser",
Sql: "sql",
});
const executeStatementResult = await awsRedshiftClient.send(executeStatementCommand);
console.log(`Statement id: ${executeStatementResult.Id}`);
Execute statement with parameters
Execute statement with parameters
const { ExecuteStatementCommand } = require("@aws-sdk/client-redshift-data");
const executeStatementCommand = new ExecuteStatementCommand({
ClusterIdentifier: "clusterIdentifier",
Database: "database",
DbUser: "dbUser",
Sql: "your sql with params as :paramName",
Parameters: [
{
name: "paramName",
value: "value",
},
],
});
const executeStatementResult = await awsRedshiftClient.send(executeStatementCommand);
console.log(`Statement id: ${executeStatementResult.Id}`);
Get statement result
Get statement result
const { GetStatementResultCommand } = require("@aws-sdk/client-redshift-data");
const getStatementResultCommand = new GetStatementResultCommand({
Id: "statementId",
});
awsRedshiftClient.send(getStatementResultCommand).then(result => {
console.log(getStatementResult.Records)
})
List statements
List statements
const { ListStatementsCommand } = require("@aws-sdk/client-redshift-data");
const listStatementsCommand = new ListStatementsCommand({});
awsRedshiftClient.send(listStatementsCommand).then(result => {
console.log(result.Statements);
});
Integration
New integration from credential
aws_redshift_client = yepcode.integration.aws_redshift("credential-slug")
New integration from plain authentication data
import boto3
session = boto3.Session(
aws_access_key_id="accessKeyId",
aws_secret_access_key="secretAccessKey",
region_name="region"
)
aws_redshift_client = session.client("redshift-data")
Execute statement
Execute statement
response = aws_redshift_client.execute_statement(
ClusterIdentifier="cluster-name",
Database="db-name",
DbUser="db-user",
Sql="sql"
)
print(response.get("Id"))
Execute statement with parameters
Execute statement with parameters
sql = "select * from users where id = :id"
params = [{"name": "id", "value": "1"}]
response = aws_redshift_client.execute_statement(
ClusterIdentifier="cluster-name",
Database="db-name",
DbUser="db-user",
Sql=sql,
Parameters=params
)
print(response.get("Id"))
Describe statement
Describe statement
response = aws_redshift_client.describe_statement(Id="statement-id")
print(response.get("Status"))
Get statement result
Get statement result
response = aws_redshift_client.get_statement_result(Id="statement-id")
for record in response.get("Records", []):
print(record)
List statements
List statements
result = aws_redshift_client.list_statements()
for statement in result.get("Statements", []):
print(statement)