TimestreamQuery / Client / prepare_query

prepare_query#

TimestreamQuery.Client.prepare_query(**kwargs)#

A synchronous operation that allows you to submit a query with parameters to be stored by Timestream for later running. Timestream only supports using this operation with ValidateOnly set to true.

See also: AWS API Documentation

Request Syntax

response = client.prepare_query(
    QueryString='string',
    ValidateOnly=True|False
)
Parameters:
  • QueryString (string) –

    [REQUIRED]

    The Timestream query string that you want to use as a prepared statement. Parameter names can be specified in the query string @ character followed by an identifier.

  • ValidateOnly (boolean) – By setting this value to true, Timestream will only validate that the query string is a valid Timestream query, and not store the prepared query for later use.

Return type:

dict

Returns:

Response Syntax

{
    'QueryString': 'string',
    'Columns': [
        {
            'Name': 'string',
            'Type': {
                'ScalarType': 'VARCHAR'|'BOOLEAN'|'BIGINT'|'DOUBLE'|'TIMESTAMP'|'DATE'|'TIME'|'INTERVAL_DAY_TO_SECOND'|'INTERVAL_YEAR_TO_MONTH'|'UNKNOWN'|'INTEGER',
                'ArrayColumnInfo': {
                    'Name': 'string',
                    'Type': {'... recursive ...'}
                },
                'TimeSeriesMeasureValueColumnInfo': {
                    'Name': 'string',
                    'Type': {'... recursive ...'}
                },
                'RowColumnInfo': [
                    {
                        'Name': 'string',
                        'Type': {'... recursive ...'}
                    },
                ]
            },
            'DatabaseName': 'string',
            'TableName': 'string',
            'Aliased': True|False
        },
    ],
    'Parameters': [
        {
            'Name': 'string',
            'Type': {
                'ScalarType': 'VARCHAR'|'BOOLEAN'|'BIGINT'|'DOUBLE'|'TIMESTAMP'|'DATE'|'TIME'|'INTERVAL_DAY_TO_SECOND'|'INTERVAL_YEAR_TO_MONTH'|'UNKNOWN'|'INTEGER',
                'ArrayColumnInfo': {
                    'Name': 'string',
                    'Type': {'... recursive ...'}
                },
                'TimeSeriesMeasureValueColumnInfo': {
                    'Name': 'string',
                    'Type': {'... recursive ...'}
                },
                'RowColumnInfo': [
                    {
                        'Name': 'string',
                        'Type': {'... recursive ...'}
                    },
                ]
            }
        },
    ]
}

Response Structure

  • (dict) –

    • QueryString (string) –

      The query string that you want prepare.

    • Columns (list) –

      A list of SELECT clause columns of the submitted query string.

      • (dict) –

        Details of the column that is returned by the query.

        • Name (string) –

          Name of the column.

        • Type (dict) –

          Contains the data type of a column in a query result set. The data type can be scalar or complex. The supported scalar data types are integers, Boolean, string, double, timestamp, date, time, and intervals. The supported complex data types are arrays, rows, and timeseries.

          • ScalarType (string) –

            Indicates if the column is of type string, integer, Boolean, double, timestamp, date, time. For more information, see Supported data types.

          • ArrayColumnInfo (dict) –

            Indicates if the column is an array.

            • Name (string) –

              The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

            • Type (dict) –

              The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

          • TimeSeriesMeasureValueColumnInfo (dict) –

            Indicates if the column is a timeseries data type.

            • Name (string) –

              The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

            • Type (dict) –

              The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

          • RowColumnInfo (list) –

            Indicates if the column is a row.

            • (dict) –

              Contains the metadata for query results such as the column names, data types, and other attributes.

              • Name (string) –

                The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

              • Type (dict) –

                The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

        • DatabaseName (string) –

          Database that has this column.

        • TableName (string) –

          Table within the database that has this column.

        • Aliased (boolean) –

          True, if the column name was aliased by the query. False otherwise.

    • Parameters (list) –

      A list of parameters used in the submitted query string.

      • (dict) –

        Mapping for named parameters.

        • Name (string) –

          Parameter name.

        • Type (dict) –

          Contains the data type of a column in a query result set. The data type can be scalar or complex. The supported scalar data types are integers, Boolean, string, double, timestamp, date, time, and intervals. The supported complex data types are arrays, rows, and timeseries.

          • ScalarType (string) –

            Indicates if the column is of type string, integer, Boolean, double, timestamp, date, time. For more information, see Supported data types.

          • ArrayColumnInfo (dict) –

            Indicates if the column is an array.

            • Name (string) –

              The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

            • Type (dict) –

              The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

          • TimeSeriesMeasureValueColumnInfo (dict) –

            Indicates if the column is a timeseries data type.

            • Name (string) –

              The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

            • Type (dict) –

              The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

          • RowColumnInfo (list) –

            Indicates if the column is a row.

            • (dict) –

              Contains the metadata for query results such as the column names, data types, and other attributes.

              • Name (string) –

                The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

              • Type (dict) –

                The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

Exceptions

  • TimestreamQuery.Client.exceptions.AccessDeniedException

  • TimestreamQuery.Client.exceptions.InternalServerException

  • TimestreamQuery.Client.exceptions.ThrottlingException

  • TimestreamQuery.Client.exceptions.ValidationException

  • TimestreamQuery.Client.exceptions.InvalidEndpointException