Skip to content

aws.glue.get_table_version

Example SQL Queries

SELECT * FROM
aws.glue.get_table_version
WHERE
"database_name" = 'VALUE'
AND "table_name" = 'VALUE';

Description

Retrieves a specified version of a table.

Table Definition

Column NameColumn Data Type
database_name Required Input Column

The database in the catalog in which the table resides. For Hive compatibility, this name is entirely lowercase.

VARCHAR
table_name Required Input Column

The name of the table. For Hive compatibility, this name is entirely lowercase.

VARCHAR
catalog_id Input Column

The ID of the Data Catalog where the tables reside. If none is provided, the Amazon Web Services account ID is used by default.

VARCHAR
version_id Input Column

The ID value of the table version to be retrieved. A VersionID is a string representation of an integer. Each version is incremented by 1.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
table_version

The requested table version.

STRUCT(
"table" STRUCT(
"name" VARCHAR,
"database_name" VARCHAR,
"description" VARCHAR,
"owner" VARCHAR,
"create_time" TIMESTAMP_S,
"update_time" TIMESTAMP_S,
"last_access_time" TIMESTAMP_S,
"last_analyzed_time" TIMESTAMP_S,
"retention" BIGINT,
"storage_descriptor" STRUCT(
"columns" STRUCT(
"name" VARCHAR,
"type" VARCHAR,
"comment" VARCHAR,
"parameters" MAP(VARCHAR, VARCHAR)
)[],
"location" VARCHAR,
"additional_locations" VARCHAR[],
"input_format" VARCHAR,
"output_format" VARCHAR,
"compressed" BOOLEAN,
"number_of_buckets" BIGINT,
"serde_info" STRUCT(
"name" VARCHAR,
"serialization_library" VARCHAR,
"parameters" MAP(VARCHAR, VARCHAR)
),
"bucket_columns" VARCHAR[],
"sort_columns" STRUCT(
"column" VARCHAR,
"sort_order" BIGINT
)[],
"parameters" MAP(VARCHAR, VARCHAR),
"skewed_info" STRUCT(
"skewed_column_names" VARCHAR[],
"skewed_column_values" VARCHAR[],
"skewed_column_value_location_maps" MAP(VARCHAR, VARCHAR)
),
"stored_as_sub_directories" BOOLEAN,
"schema_reference" STRUCT(
"schema_id" STRUCT(
"schema_arn" VARCHAR,
"schema_name" VARCHAR,
"registry_name" VARCHAR
),
"schema_version_id" VARCHAR,
"schema_version_number" BIGINT
)
),
"partition_keys" STRUCT(
"name" VARCHAR,
"type" VARCHAR,
"comment" VARCHAR,
"parameters" MAP(VARCHAR, VARCHAR)
)[],
"view_original_text" VARCHAR,
"view_expanded_text" VARCHAR,
"table_type" VARCHAR,
"parameters" MAP(VARCHAR, VARCHAR),
"created_by" VARCHAR,
"is_registered_with_lake_formation" BOOLEAN,
"target_table" STRUCT(
"catalog_id" VARCHAR,
"database_name" VARCHAR,
"name" VARCHAR,
"region" VARCHAR
),
"catalog_id" VARCHAR,
"version_id" VARCHAR,
"federated_table" STRUCT(
"identifier" VARCHAR,
"database_identifier" VARCHAR,
"connection_name" VARCHAR
),
"view_definition" STRUCT(
"is_protected" BOOLEAN,
"definer" VARCHAR,
"sub_objects" VARCHAR[],
"representations" STRUCT(
"dialect" VARCHAR,
"dialect_version" VARCHAR,
"view_original_text" VARCHAR,
"view_expanded_text" VARCHAR,
"validation_connection" VARCHAR,
"is_stale" BOOLEAN
)[]
),
"is_multi_dialect_view" BOOLEAN,
"status" STRUCT(
"requested_by" VARCHAR,
"updated_by" VARCHAR,
"request_time" TIMESTAMP_S,
"update_time" TIMESTAMP_S,
"action" VARCHAR,
"state" VARCHAR,
"error" STRUCT(
"error_code" VARCHAR,
"error_message" VARCHAR
),
"details" STRUCT(
"view_validations" STRUCT(
"dialect" VARCHAR,
"dialect_version" VARCHAR,
"view_validation_text" VARCHAR,
"update_time" TIMESTAMP_S,
"state" VARCHAR,
"error" STRUCT(
"error_code" VARCHAR,
"error_message" VARCHAR
)
)[]
)
)
),
"version_id" VARCHAR
)
Show child fields
table_version.table

The table in question.

Show child fields
table_version.table.catalog_id

The ID of the Data Catalog in which the table resides.

table_version.table.create_time

The time when the table definition was created in the Data Catalog.

table_version.table.created_by

The person or entity who created the table.

table_version.table.database_name

The name of the database where the table metadata resides. For Hive compatibility, this must be all lowercase.

table_version.table.description

A description of the table.

table_version.table.federated_table

A FederatedTable structure that references an entity outside the Glue Data Catalog.

Show child fields
table_version.table.federated_table.connection_name

The name of the connection to the external metastore.

table_version.table.federated_table.database_identifier

A unique identifier for the federated database.

table_version.table.federated_table.identifier

A unique identifier for the federated table.

table_version.table.is_multi_dialect_view

Specifies whether the view supports the SQL dialects of one or more different query engines and can therefore be read by those engines.

table_version.table.is_registered_with_lake_formation

Indicates whether the table has been registered with Lake Formation.

table_version.table.last_access_time

The last time that the table was accessed. This is usually taken from HDFS, and might not be reliable.

table_version.table.last_analyzed_time

The last time that column statistics were computed for this table.

table_version.table.name

The table name. For Hive compatibility, this must be entirely lowercase.

table_version.table.owner

The owner of the table.

table_version.table.parameters

These key-value pairs define properties associated with the table.

table_version.table.partition_keys[]
Show child fields
table_version.table.partition_keys[].comment

A free-form text comment.

table_version.table.partition_keys[].name

The name of the Column.

table_version.table.partition_keys[].parameters

These key-value pairs define properties associated with the column.

table_version.table.partition_keys[].type

The data type of the Column.

table_version.table.retention

The retention time for this table.

table_version.table.status

A structure containing information about the state of an asynchronous change to a table.

Show child fields
table_version.table.status.action

Indicates which action was called on the table, currently only CREATE or UPDATE.

table_version.table.status.details

A StatusDetails object with information about the requested change.

Show child fields
table_version.table.status.details.view_validations[]
Show child fields
table_version.table.status.details.view_validations[].dialect

The dialect of the query engine.

table_version.table.status.details.view_validations[].dialect_version

The version of the dialect of the query engine. For example, 3.0.0.

table_version.table.status.details.view_validations[].error

An error associated with the validation.

Show child fields
table_version.table.status.details.view_validations[].error.error_code

The code associated with this error.

table_version.table.status.details.view_validations[].error.error_message

A message describing the error.

table_version.table.status.details.view_validations[].state

The state of the validation.

table_version.table.status.details.view_validations[].update_time

The time of the last update.

table_version.table.status.details.view_validations[].view_validation_text

The SELECT query that defines the view, as provided by the customer.

table_version.table.status.error

An error that will only appear when the state is "FAILED". This is a parent level exception message, there may be different Errors for each dialect.

Show child fields
table_version.table.status.error.error_code

The code associated with this error.

table_version.table.status.error.error_message

A message describing the error.

table_version.table.status.request_time

An ISO 8601 formatted date string indicating the time that the change was initiated.

table_version.table.status.requested_by

The ARN of the user who requested the asynchronous change.

table_version.table.status.state

A generic status for the change in progress, such as QUEUED, IN_PROGRESS, SUCCESS, or FAILED.

table_version.table.status.update_time

An ISO 8601 formatted date string indicating the time that the state was last updated.

table_version.table.status.updated_by

The ARN of the user to last manually alter the asynchronous change (requesting cancellation, etc).

table_version.table.storage_descriptor

A storage descriptor containing information about the physical storage of this table.

Show child fields
table_version.table.storage_descriptor.additional_locations[]
table_version.table.storage_descriptor.bucket_columns[]
table_version.table.storage_descriptor.columns[]
Show child fields
table_version.table.storage_descriptor.columns[].comment

A free-form text comment.

table_version.table.storage_descriptor.columns[].name

The name of the Column.

table_version.table.storage_descriptor.columns[].parameters

These key-value pairs define properties associated with the column.

table_version.table.storage_descriptor.columns[].type

The data type of the Column.

table_version.table.storage_descriptor.compressed

True if the data in the table is compressed, or False if not.

table_version.table.storage_descriptor.input_format

The input format: SequenceFileInputFormat (binary), or TextInputFormat, or a custom format.

table_version.table.storage_descriptor.location

The physical location of the table. By default, this takes the form of the warehouse location, followed by the database location in the warehouse, followed by the table name.

table_version.table.storage_descriptor.number_of_buckets

Must be specified if the table contains any dimension columns.

table_version.table.storage_descriptor.output_format

The output format: SequenceFileOutputFormat (binary), or IgnoreKeyTextOutputFormat, or a custom format.

table_version.table.storage_descriptor.parameters

The user-supplied properties in key-value form.

table_version.table.storage_descriptor.schema_reference

An object that references a schema stored in the Glue Schema Registry.

When creating a table, you can pass an empty list of columns for the schema, and instead use a schema reference.

Show child fields
table_version.table.storage_descriptor.schema_reference.schema_id

A structure that contains schema identity fields. Either this or the SchemaVersionId has to be provided.

Show child fields
table_version.table.storage_descriptor.schema_reference.schema_id.registry_name

The name of the schema registry that contains the schema.

table_version.table.storage_descriptor.schema_reference.schema_id.schema_arn

The Amazon Resource Name (ARN) of the schema. One of SchemaArn or SchemaName has to be provided.

table_version.table.storage_descriptor.schema_reference.schema_id.schema_name

The name of the schema. One of SchemaArn or SchemaName has to be provided.

table_version.table.storage_descriptor.schema_reference.schema_version_id

The unique ID assigned to a version of the schema. Either this or the SchemaId has to be provided.

table_version.table.storage_descriptor.schema_reference.schema_version_number

The version number of the schema.

table_version.table.storage_descriptor.serde_info

The serialization/deserialization (SerDe) information.

Show child fields
table_version.table.storage_descriptor.serde_info.name

Name of the SerDe.

table_version.table.storage_descriptor.serde_info.parameters

These key-value pairs define initialization parameters for the SerDe.

table_version.table.storage_descriptor.serde_info.serialization_library

Usually the class that implements the SerDe. An example is org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe.

table_version.table.storage_descriptor.skewed_info

The information about values that appear frequently in a column (skewed values).

Show child fields
table_version.table.storage_descriptor.skewed_info.skewed_column_names[]
table_version.table.storage_descriptor.skewed_info.skewed_column_value_location_maps

A mapping of skewed values to the columns that contain them.

table_version.table.storage_descriptor.skewed_info.skewed_column_values[]
table_version.table.storage_descriptor.sort_columns[]
Show child fields
table_version.table.storage_descriptor.sort_columns[].column

The name of the column.

table_version.table.storage_descriptor.sort_columns[].sort_order

Indicates that the column is sorted in ascending order (== 1), or in descending order (==0).

table_version.table.storage_descriptor.stored_as_sub_directories

True if the table data is stored in subdirectories, or False if not.

table_version.table.table_type

The type of this table. Glue will create tables with the EXTERNAL_TABLE type. Other services, such as Athena, may create tables with additional table types.

Glue related table types:

EXTERNAL_TABLE

Hive compatible attribute - indicates a non-Hive managed table.

GOVERNED

Used by Lake Formation. The Glue Data Catalog understands GOVERNED.

table_version.table.target_table

A TableIdentifier structure that describes a target table for resource linking.

Show child fields
table_version.table.target_table.catalog_id

The ID of the Data Catalog in which the table resides.

table_version.table.target_table.database_name

The name of the catalog database that contains the target table.

table_version.table.target_table.name

The name of the target table.

table_version.table.target_table.region

Region of the target table.

table_version.table.update_time

The last time that the table was updated.

table_version.table.version_id

The ID of the table version.

table_version.table.view_definition

A structure that contains all the information that defines the view, including the dialect or dialects for the view, and the query.

Show child fields
table_version.table.view_definition.definer

The definer of a view in SQL.

table_version.table.view_definition.is_protected

You can set this flag as true to instruct the engine not to push user-provided operations into the logical plan of the view during query planning. However, setting this flag does not guarantee that the engine will comply. Refer to the engine's documentation to understand the guarantees provided, if any.

table_version.table.view_definition.representations[]
Show child fields
table_version.table.view_definition.representations[].dialect

The dialect of the query engine.

table_version.table.view_definition.representations[].dialect_version

The version of the dialect of the query engine. For example, 3.0.0.

table_version.table.view_definition.representations[].is_stale

Dialects marked as stale are no longer valid and must be updated before they can be queried in their respective query engines.

table_version.table.view_definition.representations[].validation_connection

The name of the connection to be used to validate the specific representation of the view.

table_version.table.view_definition.representations[].view_expanded_text

The expanded SQL for the view. This SQL is used by engines while processing a query on a view. Engines may perform operations during view creation to transform ViewOriginalText to ViewExpandedText. For example:

  • Fully qualified identifiers: SELECT * from table1 -> SELECT * from db1.table1

table_version.table.view_definition.representations[].view_original_text

The SELECT query provided by the customer during CREATE VIEW DDL. This SQL is not used during a query on a view (ViewExpandedText is used instead). ViewOriginalText is used for cases like SHOW CREATE VIEW where users want to see the original DDL command that created the view.

table_version.table.view_definition.sub_objects[]
table_version.table.view_expanded_text

Included for Apache Hive compatibility. Not used in the normal course of Glue operations.

table_version.table.view_original_text

Included for Apache Hive compatibility. Not used in the normal course of Glue operations. If the table is a VIRTUAL_VIEW, certain Athena configuration encoded in base64.

table_version.version_id

The ID value that identifies this table version. A VersionId is a string representation of an integer. Each version is incremented by 1.