snippets_js
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);
});