Redshift Data API Service

2021/02/23 - Redshift Data API Service - 3 updated api methods

Changes  This release adds an additional parameter 'ConnectedDatabase' into ListSchemasRequest, ListTablesRequest and DescribeTableRequest to support the metadata sharing across databases.

DescribeTable (updated) Link ¶
Changes (request)
{'ConnectedDatabase': 'string'}

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:

  • AWS Secrets Manager - specify the Amazon Resource Name (ARN) of the secret and the cluster identifier that matches the cluster in the secret.

  • Temporary credentials - specify the cluster identifier, the database name, and the database user name. Permission to call the redshift:GetClusterCredentials operation is required to use this method.

See also: AWS API Documentation

Request Syntax

client.describe_table(
    ClusterIdentifier='string',
    ConnectedDatabase='string',
    Database='string',
    DbUser='string',
    MaxResults=123,
    NextToken='string',
    Schema='string',
    SecretArn='string',
    Table='string'
)
type ClusterIdentifier

string

param ClusterIdentifier

[REQUIRED]

The cluster identifier. This parameter is required when authenticating using either AWS Secrets Manager or temporary credentials.

type ConnectedDatabase

string

param ConnectedDatabase

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

type Database

string

param Database

[REQUIRED]

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.

type DbUser

string

param DbUser

The database user name. This parameter is required when authenticating using temporary credentials.

type MaxResults

integer

param MaxResults

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.

type NextToken

string

param NextToken

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.

type Schema

string

param Schema

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

type SecretArn

string

param SecretArn

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

type Table

string

param Table

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

rtype

dict

returns

Response Syntax

{
    'ColumnList': [
        {
            'columnDefault': 'string',
            'isCaseSensitive': True|False,
            'isCurrency': True|False,
            'isSigned': True|False,
            'label': 'string',
            'length': 123,
            'name': 'string',
            'nullable': 123,
            'precision': 123,
            'scale': 123,
            'schemaName': 'string',
            'tableName': 'string',
            'typeName': 'string'
        },
    ],
    'NextToken': 'string',
    'TableName': 'string'
}

Response Structure

  • (dict) --

    • ColumnList (list) --

      A list of columns in the table.

      • (dict) --

        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.

    • TableName (string) --

      The table name.

ListSchemas (updated) Link ¶
Changes (request)
{'ConnectedDatabase': 'string'}

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:

  • AWS Secrets Manager - specify the Amazon Resource Name (ARN) of the secret and the cluster identifier that matches the cluster in the secret.

  • Temporary credentials - specify the cluster identifier, the database name, and the database user name. Permission to call the redshift:GetClusterCredentials operation is required to use this method.

See also: AWS API Documentation

Request Syntax

client.list_schemas(
    ClusterIdentifier='string',
    ConnectedDatabase='string',
    Database='string',
    DbUser='string',
    MaxResults=123,
    NextToken='string',
    SchemaPattern='string',
    SecretArn='string'
)
type ClusterIdentifier

string

param ClusterIdentifier

[REQUIRED]

The cluster identifier. This parameter is required when authenticating using either AWS Secrets Manager or temporary credentials.

type ConnectedDatabase

string

param ConnectedDatabase

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

type Database

string

param Database

[REQUIRED]

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.

type DbUser

string

param DbUser

The database user name. This parameter is required when authenticating using temporary credentials.

type MaxResults

integer

param MaxResults

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.

type NextToken

string

param NextToken

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.

type SchemaPattern

string

param SchemaPattern

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.

type SecretArn

string

param SecretArn

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

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'Schemas': [
        'string',
    ]
}

Response Structure

  • (dict) --

    • 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 (list) --

      The schemas that match the request pattern.

      • (string) --

ListTables (updated) Link ¶
Changes (request)
{'ConnectedDatabase': 'string'}

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:

  • AWS Secrets Manager - specify the Amazon Resource Name (ARN) of the secret and the cluster identifier that matches the cluster in the secret.

  • Temporary credentials - specify the cluster identifier, the database name, and the database user name. Permission to call the redshift:GetClusterCredentials operation is required to use this method.

See also: AWS API Documentation

Request Syntax

client.list_tables(
    ClusterIdentifier='string',
    ConnectedDatabase='string',
    Database='string',
    DbUser='string',
    MaxResults=123,
    NextToken='string',
    SchemaPattern='string',
    SecretArn='string',
    TablePattern='string'
)
type ClusterIdentifier

string

param ClusterIdentifier

[REQUIRED]

The cluster identifier. This parameter is required when authenticating using either AWS Secrets Manager or temporary credentials.

type ConnectedDatabase

string

param ConnectedDatabase

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

type Database

string

param Database

[REQUIRED]

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.

type DbUser

string

param DbUser

The database user name. This parameter is required when authenticating using temporary credentials.

type MaxResults

integer

param MaxResults

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.

type NextToken

string

param NextToken

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.

type SchemaPattern

string

param SchemaPattern

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.

type SecretArn

string

param SecretArn

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

type TablePattern

string

param TablePattern

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 SchemaPattern are returned. If neither SchemaPattern or TablePattern are specified, then all tables are returned.

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'Tables': [
        {
            'name': 'string',
            'schema': 'string',
            'type': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • 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 (list) --

      The tables that match the request pattern.

      • (dict) --

        The properties of a table.

        • 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.