model

Data models for AWS Redshift Data API resources.

Ref:

simple_aws_redshift.redshift_data_api.model.parse_datetime()

string -> datetime from a string in most ISO 8601 formats

class simple_aws_redshift.redshift_data_api.model.DescribeStatementResponse(raw_data: DescribeStatementResponseTypeDef = REQ)[source]

API response for https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift-data/client/describe_statement.html

property core_data: Dict[str, Any]

Returns a dictionary containing the essential data of the model.

This property must be implemented by all subclasses to provide a consistent minimal representation of the model’s core data.

class simple_aws_redshift.redshift_data_api.model.RedshiftDataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enumeration of Redshift data types as returned by the Data API

simple_aws_redshift.redshift_data_api.model.type_to_field_mapping = {'_aclitem': 'stringValue', 'bool': 'booleanValue', 'bpchar': 'stringValue', 'char': 'stringValue', 'date': 'stringValue', 'decimal': 'doubleValue', 'float4': 'doubleValue', 'float8': 'doubleValue', 'int2': 'longValue', 'int4': 'longValue', 'int8': 'longValue', 'json': 'stringValue', 'jsonb': 'stringValue', 'name': 'stringValue', 'numeric': 'stringValue', 'oid': 'longValue', 'text': 'stringValue', 'time': 'stringValue', 'timestamp': 'stringValue', 'timestamptz': 'stringValue', 'uuid': 'stringValue', 'varbyte': 'stringValue', 'varchar': 'stringValue'}

From redshift column data type to the field key where the value is stored in the Redshift Data API response.

simple_aws_redshift.redshift_data_api.model.extract_field_raw_value(column_metadata: ColumnMetadataTypeDef, field: FieldTypeDef) Any[source]

Extracts the raw value from a Redshift Data API field.

simple_aws_redshift.redshift_data_api.model.extract_field_python_native_value(column_metadata: ColumnMetadataTypeDef, raw_value: Any) Any[source]

Extracts the native Python value from a Redshift Data API field.

class simple_aws_redshift.redshift_data_api.model.GetStatementResultResponse(raw_data: GetStatementResultResponseTypeDef = REQ)[source]

API response for https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift-data/paginator/GetStatementResult.html

property core_data: Dict[str, Any]

Returns a dictionary containing the essential data of the model.

This property must be implemented by all subclasses to provide a consistent minimal representation of the model’s core data.

to_column_oriented_data(debug: bool = False) dict[str, list[Any]][source]

Convert records to a column-oriented format. Like:

{
    "column_name_1": [value1, value2, ...],
    "column_name_2": [value1, value2, ...],
}
class simple_aws_redshift.redshift_data_api.model.GetStatementResultResponseIterProxy(iterable: Iterable)[source]

Iterator proxy for GetStatementResultResponse.

to_column_oriented_data() dict[str, list[Any]][source]

Convert all records in the iterator to a column-oriented format. Like:

{
    "column_name_1": [value1, value2, ...],
    "column_name_2": [value1, value2, ...],
}
class simple_aws_redshift.redshift_data_api.model.VirtualDataFrame(columns: list[str], col_data: dict[str, list[Any]])[source]

A virtual dataframe that can represent tabular data in various formats.

Parameters:
  • columns – List of column names. Example: [‘col1’, ‘col2’, ‘col3’]

  • col_data – Dictionary mapping column names to lists of column values. Example: {‘col1’: [1, 2, 3], ‘col2’: [‘a’, ‘b’, ‘c’], ‘col3’: [True, False, True]}

iter_rows() Iterator[tuple[Any, ...]][source]

Iterator over rows in the virtual dataframe.

property rows

List of rows in the virtual dataframe.

property n_columns

Number of columns in the virtual dataframe.

property n_rows

Number of rows in the virtual dataframe.

property tabulate_table: str

Render the virtual dataframe as a table using the tabulate library.

property pandas_df: DataFrame

Convert the virtual dataframe to a pandas DataFrame.

property polars_df: DataFrame

Convert the virtual dataframe to a polars DataFrame.

class simple_aws_redshift.redshift_data_api.model.ConsolidatedStatementResult(response_list: list[GetStatementResultResponse])[source]

Consolidated result from multiple GetStatementResultResponse instances.

property vdf: VirtualDataFrame

Convert the consolidated results into a VirtualDataFrame.