We announced the upcoming end-of-support for AWS SDK for JavaScript v2.
We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Class: AWS.RedshiftData

Inherits:
AWS.Service show all
Identifier:
redshiftdata
API Version:
2019-12-20
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

You can use the Amazon Redshift Data API to run queries on Amazon Redshift tables. You can run SQL statements, which are committed if the statement succeeds.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Sending a Request Using RedshiftData

var redshiftdata = new AWS.RedshiftData();
redshiftdata.batchExecuteStatement(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the RedshiftData object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var redshiftdata = new AWS.RedshiftData({apiVersion: '2019-12-20'});

You can also set the API version globally in AWS.config.apiVersions using the redshiftdata service identifier:

AWS.config.apiVersions = {
  redshiftdata: '2019-12-20',
  // other service API versions
};

var redshiftdata = new AWS.RedshiftData();

Version:

  • 2019-12-20

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.RedshiftData(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a RedshiftData object

var redshiftdata = new AWS.RedshiftData({apiVersion: '2019-12-20'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.RedshiftData.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.RedshiftData.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.RedshiftData.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

  • useFipsEndpoint (Boolean)

    Enables FIPS compatible endpoints. Defaults to false.

  • useDualstackEndpoint (Boolean)

    Enables IPv6 dualstack endpoint. Defaults to false.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

batchExecuteStatement(params = {}, callback) ⇒ AWS.Request

Runs one or more SQL statements, which can be data manipulation language (DML) or data definition language (DDL). Depending on the authorization method, use one of the following combinations of request parameters:

  • Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.

  • Temporary credentials - when connecting to your data warehouse, choose one of the following options:

    • When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.

    • When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.

    • When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the batchExecuteStatement operation

var params = {
  Sqls: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  ClientToken: 'STRING_VALUE',
  ClusterIdentifier: 'STRING_VALUE',
  Database: 'STRING_VALUE',
  DbUser: 'STRING_VALUE',
  SecretArn: 'STRING_VALUE',
  SessionId: 'STRING_VALUE',
  SessionKeepAliveSeconds: 'NUMBER_VALUE',
  StatementName: 'STRING_VALUE',
  WithEvent: true || false,
  WorkgroupName: 'STRING_VALUE'
};
redshiftdata.batchExecuteStatement(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientToken — (String)

      A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

      If a token is not provided, the SDK will use a version 4 UUID.
    • ClusterIdentifier — (String)

      The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

    • Database — (String)

      The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.

    • DbUser — (String)

      The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

    • SecretArn — (String)

      The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

    • SessionId — (String)

      The session identifier of the query.

    • SessionKeepAliveSeconds — (Integer)

      The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.

    • Sqls — (Array<String>)

      One or more SQL statements to run.

       The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don't start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.</p> 
    • StatementName — (String)

      The name of the SQL statements. You can name the SQL statements when you create them to identify the query.

    • WithEvent — (Boolean)

      A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements run.

    • WorkgroupName — (String)

      The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ClusterIdentifier — (String)

        The cluster identifier. This element is not returned when connecting to a serverless workgroup.

      • CreatedAt — (Date)

        The date and time (UTC) the statement was created.

      • Database — (String)

        The name of the database.

      • DbGroups — (Array<String>)

        A list of colon (:) separated names of database groups.

      • DbUser — (String)

        The database user name.

      • Id — (String)

        The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This identifier is returned by BatchExecuteStatment.

      • SecretArn — (String)

        The name or ARN of the secret that enables access to the database.

      • SessionId — (String)

        The session identifier of the query.

      • WorkgroupName — (String)

        The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

cancelStatement(params = {}, callback) ⇒ AWS.Request

Cancels a running query. To be canceled, a query must be running.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the cancelStatement operation

var params = {
  Id: 'STRING_VALUE' /* required */
};
redshiftdata.cancelStatement(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Id — (String)

      The identifier of the SQL statement to cancel. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Status — (Boolean)

        A value that indicates whether the cancel statement succeeded (true).

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeStatement(params = {}, callback) ⇒ AWS.Request

Describes the details about a specific instance when a query was run by the Amazon Redshift Data API. The information includes when the query started, when it finished, the query status, the number of rows returned, and the SQL statement.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the describeStatement operation

var params = {
  Id: 'STRING_VALUE' /* required */
};
redshiftdata.describeStatement(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Id — (String)

      The identifier of the SQL statement to describe. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. A suffix indicates the number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatement, and ListStatements.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ClusterIdentifier — (String)

        The cluster identifier.

      • CreatedAt — (Date)

        The date and time (UTC) when the SQL statement was submitted to run.

      • Database — (String)

        The name of the database.

      • DbUser — (String)

        The database user name.

      • Duration — (Integer)

        The amount of time in nanoseconds that the statement ran.

      • Error — (String)

        The error message from the cluster if the SQL statement encountered an error while running.

      • HasResultSet — (Boolean)

        A value that indicates whether the statement has a result set. The result set can be empty. The value is true for an empty result set. The value is true if any substatement returns a result set.

      • Id — (String)

        The identifier of the SQL statement described. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.

      • QueryParameters — (Array<map>)

        The parameters for the SQL statement.

        • namerequired — (String)

          The name of the parameter.

        • valuerequired — (String)

          The value of the parameter. Amazon Redshift implicitly converts to the proper data type. For more information, see Data types in the Amazon Redshift Database Developer Guide.

      • QueryString — (String)

        The SQL statement text.

      • RedshiftPid — (Integer)

        The process identifier from Amazon Redshift.

      • RedshiftQueryId — (Integer)

        The identifier of the query generated by Amazon Redshift. These identifiers are also available in the query column of the STL_QUERY system view.

      • ResultRows — (Integer)

        Either the number of rows returned from the SQL statement or the number of rows affected. If result size is greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, UPDATE, DELETE, COPY, and others. A -1 indicates the value is null.

      • ResultSize — (Integer)

        The size in bytes of the returned results. A -1 indicates the value is null.

      • SecretArn — (String)

        The name or Amazon Resource Name (ARN) of the secret that enables access to the database.

      • SessionId — (String)

        The session identifier of the query.

      • Status — (String)

        The status of the SQL statement being described. Status values are defined as follows:

        • ABORTED - The query run was stopped by the user.

        • ALL - A status value that includes all query statuses. This value can be used to filter results.

        • FAILED - The query run failed.

        • FINISHED - The query has finished running.

        • PICKED - The query has been chosen to be run.

        • STARTED - The query run has started.

        • SUBMITTED - The query was submitted, but not yet processed.

        Possible values include:
        • "SUBMITTED"
        • "PICKED"
        • "STARTED"
        • "FINISHED"
        • "ABORTED"
        • "FAILED"
        • "ALL"
      • SubStatements — (Array<map>)

        The SQL statements from a multiple statement run.

        • CreatedAt — (Date)

          The date and time (UTC) the statement was created.

        • Duration — (Integer)

          The amount of time in nanoseconds that the statement ran.

        • Error — (String)

          The error message from the cluster if the SQL statement encountered an error while running.

        • HasResultSet — (Boolean)

          A value that indicates whether the statement has a result set. The result set can be empty. The value is true for an empty result set.

        • Idrequired — (String)

          The identifier of the SQL statement. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. A suffix indicates the number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query.

        • QueryString — (String)

          The SQL statement text.

        • RedshiftQueryId — (Integer)

          The SQL statement identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.

        • ResultRows — (Integer)

          Either the number of rows returned from the SQL statement or the number of rows affected. If result size is greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, UPDATE, DELETE, COPY, and others. A -1 indicates the value is null.

        • ResultSize — (Integer)

          The size in bytes of the returned results. A -1 indicates the value is null.

        • Status — (String)

          The status of the SQL statement. An example is the that the SQL statement finished.

          Possible values include:
          • "SUBMITTED"
          • "PICKED"
          • "STARTED"
          • "FINISHED"
          • "ABORTED"
          • "FAILED"
        • UpdatedAt — (Date)

          The date and time (UTC) that the statement metadata was last updated.

      • UpdatedAt — (Date)

        The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time the status last changed.

      • WorkgroupName — (String)

        The serverless workgroup name or Amazon Resource Name (ARN).

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeTable(params = {}, callback) ⇒ AWS.Request

Describes the detailed information about a table from metadata in the cluster. The information includes its columns. A token is returned to page through the column list. Depending on the authorization method, use one of the following combinations of request parameters:

  • Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.

  • Temporary credentials - when connecting to your data warehouse, choose one of the following options:

    • When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.

    • When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.

    • When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the describeTable operation

var params = {
  Database: 'STRING_VALUE', /* required */
  ClusterIdentifier: 'STRING_VALUE',
  ConnectedDatabase: 'STRING_VALUE',
  DbUser: 'STRING_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  Schema: 'STRING_VALUE',
  SecretArn: 'STRING_VALUE',
  Table: 'STRING_VALUE',
  WorkgroupName: 'STRING_VALUE'
};
redshiftdata.describeTable(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClusterIdentifier — (String)

      The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

    • ConnectedDatabase — (String)

      A database name. The connected database is specified when you connect with your authentication credentials.

    • Database — (String)

      The name of the database that contains the tables to be described. If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.

    • DbUser — (String)

      The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

    • MaxResults — (Integer)

      The maximum number of tables to return in the response. If more tables exist than fit in one response, then NextToken is returned to page through the results.

    • NextToken — (String)

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

    • Schema — (String)

      The schema that contains the table. If no schema is specified, then matching tables for all schemas are returned.

    • SecretArn — (String)

      The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

    • Table — (String)

      The table name. If no table is specified, then all tables for all matching schemas are returned. If no table and no schema is specified, then all tables for all schemas in the database are returned

    • WorkgroupName — (String)

      The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ColumnList — (Array<map>)

        A list of columns in the table.

        • columnDefault — (String)

          The default value of the column.

        • isCaseSensitive — (Boolean)

          A value that indicates whether the column is case-sensitive.

        • isCurrency — (Boolean)

          A value that indicates whether the column contains currency values.

        • isSigned — (Boolean)

          A value that indicates whether an integer column is signed.

        • label — (String)

          The label for the column.

        • length — (Integer)

          The length of the column.

        • name — (String)

          The name of the column.

        • nullable — (Integer)

          A value that indicates whether the column is nullable.

        • precision — (Integer)

          The precision value of a decimal number column.

        • scale — (Integer)

          The scale value of a decimal number column.

        • schemaName — (String)

          The name of the schema that contains the table that includes the column.

        • tableName — (String)

          The name of the table that includes the column.

        • typeName — (String)

          The database-specific data type of the column.

      • NextToken — (String)

        A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

      • TableName — (String)

        The table name.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

executeStatement(params = {}, callback) ⇒ AWS.Request

Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL). This statement must be a single SQL statement. Depending on the authorization method, use one of the following combinations of request parameters:

  • Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.

  • Temporary credentials - when connecting to your data warehouse, choose one of the following options:

    • When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.

    • When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.

    • When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the executeStatement operation

var params = {
  Sql: 'STRING_VALUE', /* required */
  ClientToken: 'STRING_VALUE',
  ClusterIdentifier: 'STRING_VALUE',
  Database: 'STRING_VALUE',
  DbUser: 'STRING_VALUE',
  Parameters: [
    {
      name: 'STRING_VALUE', /* required */
      value: 'STRING_VALUE' /* required */
    },
    /* more items */
  ],
  SecretArn: 'STRING_VALUE',
  SessionId: 'STRING_VALUE',
  SessionKeepAliveSeconds: 'NUMBER_VALUE',
  StatementName: 'STRING_VALUE',
  WithEvent: true || false,
  WorkgroupName: 'STRING_VALUE'
};
redshiftdata.executeStatement(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientToken — (String)

      A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

      If a token is not provided, the SDK will use a version 4 UUID.
    • ClusterIdentifier — (String)

      The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

    • Database — (String)

      The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.

    • DbUser — (String)

      The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

    • Parameters — (Array<map>)

      The parameters for the SQL statement.

      • namerequired — (String)

        The name of the parameter.

      • valuerequired — (String)

        The value of the parameter. Amazon Redshift implicitly converts to the proper data type. For more information, see Data types in the Amazon Redshift Database Developer Guide.

    • SecretArn — (String)

      The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

    • SessionId — (String)

      The session identifier of the query.

    • SessionKeepAliveSeconds — (Integer)

      The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.

    • Sql — (String)

      The SQL statement text to run.

    • StatementName — (String)

      The name of the SQL statement. You can name the SQL statement when you create it to identify the query.

    • WithEvent — (Boolean)

      A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.

    • WorkgroupName — (String)

      The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ClusterIdentifier — (String)

        The cluster identifier. This element is not returned when connecting to a serverless workgroup.

      • CreatedAt — (Date)

        The date and time (UTC) the statement was created.

      • Database — (String)

        The name of the database.

      • DbGroups — (Array<String>)

        A list of colon (:) separated names of database groups.

      • DbUser — (String)

        The database user name.

      • Id — (String)

        The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.

      • SecretArn — (String)

        The name or ARN of the secret that enables access to the database.

      • SessionId — (String)

        The session identifier of the query.

      • WorkgroupName — (String)

        The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getStatementResult(params = {}, callback) ⇒ AWS.Request

Fetches the temporarily cached result of an SQL statement. A token is returned to page through the statement results.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the getStatementResult operation

var params = {
  Id: 'STRING_VALUE', /* required */
  NextToken: 'STRING_VALUE'
};
redshiftdata.getStatementResult(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Id — (String)

      The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. A suffix indicates then number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

    • NextToken — (String)

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ColumnMetadata — (Array<map>)

        The properties (metadata) of a column.

        • columnDefault — (String)

          The default value of the column.

        • isCaseSensitive — (Boolean)

          A value that indicates whether the column is case-sensitive.

        • isCurrency — (Boolean)

          A value that indicates whether the column contains currency values.

        • isSigned — (Boolean)

          A value that indicates whether an integer column is signed.

        • label — (String)

          The label for the column.

        • length — (Integer)

          The length of the column.

        • name — (String)

          The name of the column.

        • nullable — (Integer)

          A value that indicates whether the column is nullable.

        • precision — (Integer)

          The precision value of a decimal number column.

        • scale — (Integer)

          The scale value of a decimal number column.

        • schemaName — (String)

          The name of the schema that contains the table that includes the column.

        • tableName — (String)

          The name of the table that includes the column.

        • typeName — (String)

          The database-specific data type of the column.

      • NextToken — (String)

        A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

      • Records — (Array<Array<map>>)

        The results of the SQL statement.

        • blobValue — (Buffer, Typed Array, Blob, String)

          A value of the BLOB data type.

        • booleanValue — (Boolean)

          A value of the Boolean data type.

        • doubleValue — (Float)

          A value of the double data type.

        • isNull — (Boolean)

          A value that indicates whether the data is NULL.

        • longValue — (Integer)

          A value of the long data type.

        • stringValue — (String)

          A value of the string data type.

      • TotalNumRows — (Integer)

        The total number of rows in the result set returned from a query. You can use this number to estimate the number of calls to the GetStatementResult operation needed to page through the results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listDatabases(params = {}, callback) ⇒ AWS.Request

List the databases in a cluster. A token is returned to page through the database list. Depending on the authorization method, use one of the following combinations of request parameters:

  • Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.

  • Temporary credentials - when connecting to your data warehouse, choose one of the following options:

    • When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.

    • When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.

    • When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the listDatabases operation

var params = {
  Database: 'STRING_VALUE', /* required */
  ClusterIdentifier: 'STRING_VALUE',
  DbUser: 'STRING_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  SecretArn: 'STRING_VALUE',
  WorkgroupName: 'STRING_VALUE'
};
redshiftdata.listDatabases(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClusterIdentifier — (String)

      The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

    • Database — (String)

      The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.

    • DbUser — (String)

      The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

    • MaxResults — (Integer)

      The maximum number of databases to return in the response. If more databases exist than fit in one response, then NextToken is returned to page through the results.

    • NextToken — (String)

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

    • SecretArn — (String)

      The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

    • WorkgroupName — (String)

      The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Databases — (Array<String>)

        The names of databases.

      • NextToken — (String)

        A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listSchemas(params = {}, callback) ⇒ AWS.Request

Lists the schemas in a database. A token is returned to page through the schema list. Depending on the authorization method, use one of the following combinations of request parameters:

  • Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.

  • Temporary credentials - when connecting to your data warehouse, choose one of the following options:

    • When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.

    • When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.

    • When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the listSchemas operation

var params = {
  Database: 'STRING_VALUE', /* required */
  ClusterIdentifier: 'STRING_VALUE',
  ConnectedDatabase: 'STRING_VALUE',
  DbUser: 'STRING_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  SchemaPattern: 'STRING_VALUE',
  SecretArn: 'STRING_VALUE',
  WorkgroupName: 'STRING_VALUE'
};
redshiftdata.listSchemas(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClusterIdentifier — (String)

      The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

    • ConnectedDatabase — (String)

      A database name. The connected database is specified when you connect with your authentication credentials.

    • Database — (String)

      The name of the database that contains the schemas to list. If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.

    • DbUser — (String)

      The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

    • MaxResults — (Integer)

      The maximum number of schemas to return in the response. If more schemas exist than fit in one response, then NextToken is returned to page through the results.

    • NextToken — (String)

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

    • SchemaPattern — (String)

      A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned.

    • SecretArn — (String)

      The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

    • WorkgroupName — (String)

      The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NextToken — (String)

        A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

      • Schemas — (Array<String>)

        The schemas that match the request pattern.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listStatements(params = {}, callback) ⇒ AWS.Request

List of SQL statements. By default, only finished statements are shown. A token is returned to page through the statement list.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the listStatements operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  RoleLevel: true || false,
  StatementName: 'STRING_VALUE',
  Status: SUBMITTED | PICKED | STARTED | FINISHED | ABORTED | FAILED | ALL
};
redshiftdata.listStatements(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • MaxResults — (Integer)

      The maximum number of SQL statements to return in the response. If more SQL statements exist than fit in one response, then NextToken is returned to page through the results.

    • NextToken — (String)

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

    • RoleLevel — (Boolean)

      A value that filters which statements to return in the response. If true, all statements run by the caller's IAM role are returned. If false, only statements run by the caller's IAM role in the current IAM session are returned. The default is true.

    • StatementName — (String)

      The name of the SQL statement specified as input to BatchExecuteStatement or ExecuteStatement to identify the query. You can list multiple statements by providing a prefix that matches the beginning of the statement name. For example, to list myStatement1, myStatement2, myStatement3, and so on, then provide the a value of myStatement. Data API does a case-sensitive match of SQL statement names to the prefix value you provide.

    • Status — (String)

      The status of the SQL statement to list. Status values are defined as follows:

      • ABORTED - The query run was stopped by the user.

      • ALL - A status value that includes all query statuses. This value can be used to filter results.

      • FAILED - The query run failed.

      • FINISHED - The query has finished running.

      • PICKED - The query has been chosen to be run.

      • STARTED - The query run has started.

      • SUBMITTED - The query was submitted, but not yet processed.

      Possible values include:
      • "SUBMITTED"
      • "PICKED"
      • "STARTED"
      • "FINISHED"
      • "ABORTED"
      • "FAILED"
      • "ALL"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NextToken — (String)

        A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

      • Statements — (Array<map>)

        The SQL statements.

        • CreatedAt — (Date)

          The date and time (UTC) the statement was created.

        • Idrequired — (String)

          The SQL statement identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.

        • IsBatchStatement — (Boolean)

          A value that indicates whether the statement is a batch query request.

        • QueryParameters — (Array<map>)

          The parameters used in a SQL statement.

          • namerequired — (String)

            The name of the parameter.

          • valuerequired — (String)

            The value of the parameter. Amazon Redshift implicitly converts to the proper data type. For more information, see Data types in the Amazon Redshift Database Developer Guide.

        • QueryString — (String)

          The SQL statement.

        • QueryStrings — (Array<String>)

          One or more SQL statements. Each query string in the array corresponds to one of the queries in a batch query request.

        • SecretArn — (String)

          The name or Amazon Resource Name (ARN) of the secret that enables access to the database.

        • SessionId — (String)

          The session identifier of the query.

        • StatementName — (String)

          The name of the SQL statement.

        • Status — (String)

          The status of the SQL statement. An example is the that the SQL statement finished.

          Possible values include:
          • "SUBMITTED"
          • "PICKED"
          • "STARTED"
          • "FINISHED"
          • "ABORTED"
          • "FAILED"
          • "ALL"
        • UpdatedAt — (Date)

          The date and time (UTC) that the statement metadata was last updated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTables(params = {}, callback) ⇒ AWS.Request

List the tables in a database. If neither SchemaPattern nor TablePattern are specified, then all tables in the database are returned. A token is returned to page through the table list. Depending on the authorization method, use one of the following combinations of request parameters:

  • Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.

  • Temporary credentials - when connecting to your data warehouse, choose one of the following options:

    • When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.

    • When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.

    • When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Service Reference:

Examples:

Calling the listTables operation

var params = {
  Database: 'STRING_VALUE', /* required */
  ClusterIdentifier: 'STRING_VALUE',
  ConnectedDatabase: 'STRING_VALUE',
  DbUser: 'STRING_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  SchemaPattern: 'STRING_VALUE',
  SecretArn: 'STRING_VALUE',
  TablePattern: 'STRING_VALUE',
  WorkgroupName: 'STRING_VALUE'
};
redshiftdata.listTables(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClusterIdentifier — (String)

      The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

    • ConnectedDatabase — (String)

      A database name. The connected database is specified when you connect with your authentication credentials.

    • Database — (String)

      The name of the database that contains the tables to list. If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.

    • DbUser — (String)

      The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

    • MaxResults — (Integer)

      The maximum number of tables to return in the response. If more tables exist than fit in one response, then NextToken is returned to page through the results.

    • NextToken — (String)

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

    • SchemaPattern — (String)

      A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If SchemaPattern is not specified, then all tables that match TablePattern are returned. If neither SchemaPattern or TablePattern are specified, then all tables are returned.

    • SecretArn — (String)

      The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

    • TablePattern — (String)

      A pattern to filter results by table name. Within a table pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only table name entries matching the search pattern are returned. If TablePattern is not specified, then all tables that match SchemaPatternare returned. If neither SchemaPattern or TablePattern are specified, then all tables are returned.

    • WorkgroupName — (String)

      The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NextToken — (String)

        A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

      • Tables — (Array<map>)

        The tables that match the request pattern.

        • name — (String)

          The name of the table.

        • schema — (String)

          The schema containing the table.

        • type — (String)

          The type of the table. Possible values include TABLE, VIEW, SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, and SYNONYM.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.