Skip to content

aws.glue.get_tables

Example SQL Queries

SELECT * FROM
aws.glue.get_tables
WHERE
"database_name" = 'VALUE';

Description

Retrieves the definitions of some or all of the tables in a given Database.

Table Definition

Column NameColumn Data Type
database_name Required Input Column

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

VARCHAR
attributes_to_get Input Column

Specifies the table fields returned by the GetTables call. This parameter doesn’t accept an empty list. The request must include NAME.

The following are the valid combinations of values:

  • NAME - Names of all tables in the database.

  • NAME, TABLE_TYPE - Names of all tables and the table types.

VARCHAR[]
Show child fields
attributes_to_get[]
catalog_id Input Column

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

VARCHAR
expression Input Column

A regular expression pattern. If present, only those tables whose names match the pattern are returned.

VARCHAR
include_status_details Input Column

Specifies whether to include status details related to a request to create or update an Glue Data Catalog view.

BOOLEAN
query_as_of_time Input Column

The time as of when to read the table contents. If not set, the most recent transaction commit time will be used. Cannot be specified along with TransactionId.

TIMESTAMP_S
transaction_id Input Column

The transaction ID at which to read the table contents.

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
create_time

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

TIMESTAMP_S
created_by

The person or entity who created the table.

VARCHAR
description

A description of the table.

VARCHAR
federated_table

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

STRUCT(
"identifier" VARCHAR,
"database_identifier" VARCHAR,
"connection_name" VARCHAR
)
Show child fields
federated_table.connection_name

The name of the connection to the external metastore.

federated_table.database_identifier

A unique identifier for the federated database.

federated_table.identifier

A unique identifier for the federated 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.

BOOLEAN
is_registered_with_lake_formation

Indicates whether the table has been registered with Lake Formation.

BOOLEAN
last_access_time

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

TIMESTAMP_S
last_analyzed_time

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

TIMESTAMP_S
name

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

VARCHAR
owner

The owner of the table.

VARCHAR
parameters

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

MAP(VARCHAR, VARCHAR)
partition_keys

A list of columns by which the table is partitioned. Only primitive types are supported as partition keys.

When you create a table used by Amazon Athena, and you do not specify any partitionKeys, you must at least set the value of partitionKeys to an empty list. For example:

"PartitionKeys": []

STRUCT(
"name" VARCHAR,
"type" VARCHAR,
"comment" VARCHAR,
"parameters" MAP(VARCHAR, VARCHAR)
)[]
Show child fields
partition_keys[]
Show child fields
partition_keys[].comment

A free-form text comment.

partition_keys[].name

The name of the Column.

partition_keys[].parameters

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

partition_keys[].type

The data type of the Column.

retention

The retention time for this table.

BIGINT
status

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

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
)
)[]
)
)
Show child fields
status.action

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

status.details

A StatusDetails object with information about the requested change.

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

The dialect of the query engine.

status.details.view_validations[].dialect_version

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

status.details.view_validations[].error

An error associated with the validation.

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

The code associated with this error.

status.details.view_validations[].error.error_message

A message describing the error.

status.details.view_validations[].state

The state of the validation.

status.details.view_validations[].update_time

The time of the last update.

status.details.view_validations[].view_validation_text

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

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
status.error.error_code

The code associated with this error.

status.error.error_message

A message describing the error.

status.request_time

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

status.requested_by

The ARN of the user who requested the asynchronous change.

status.state

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

status.update_time

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

status.updated_by

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

storage_descriptor

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

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
)
)
Show child fields
storage_descriptor.additional_locations[]
storage_descriptor.bucket_columns[]
storage_descriptor.columns[]
Show child fields
storage_descriptor.columns[].comment

A free-form text comment.

storage_descriptor.columns[].name

The name of the Column.

storage_descriptor.columns[].parameters

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

storage_descriptor.columns[].type

The data type of the Column.

storage_descriptor.compressed

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

storage_descriptor.input_format

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

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.

storage_descriptor.number_of_buckets

Must be specified if the table contains any dimension columns.

storage_descriptor.output_format

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

storage_descriptor.parameters

The user-supplied properties in key-value form.

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
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
storage_descriptor.schema_reference.schema_id.registry_name

The name of the schema registry that contains the schema.

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.

storage_descriptor.schema_reference.schema_id.schema_name

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

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.

storage_descriptor.schema_reference.schema_version_number

The version number of the schema.

storage_descriptor.serde_info

The serialization/deserialization (SerDe) information.

Show child fields
storage_descriptor.serde_info.name

Name of the SerDe.

storage_descriptor.serde_info.parameters

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

storage_descriptor.serde_info.serialization_library

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

storage_descriptor.skewed_info

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

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

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

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

The name of the column.

storage_descriptor.sort_columns[].sort_order

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

storage_descriptor.stored_as_sub_directories

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

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.

VARCHAR
target_table

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

STRUCT(
"catalog_id" VARCHAR,
"database_name" VARCHAR,
"name" VARCHAR,
"region" VARCHAR
)
Show child fields
target_table.catalog_id

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

target_table.database_name

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

target_table.name

The name of the target table.

target_table.region

Region of the target table.

update_time

The last time that the table was updated.

TIMESTAMP_S
version_id

The ID of the table version.

VARCHAR
view_definition

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

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
)[]
)
Show child fields
view_definition.definer

The definer of a view in SQL.

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.

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

The dialect of the query engine.

view_definition.representations[].dialect_version

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

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.

view_definition.representations[].validation_connection

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

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

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.

view_definition.sub_objects[]
view_expanded_text

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

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

VARCHAR