Skip to main content

tables

Creates, updates, deletes, gets or lists a tables resource.

Overview

Nametables
TypeResource
Idaws.glue.tables

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
catalog_idstringThe ID of the Data Catalog in which the table resides. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
create_timestring (date-time)The time when the table definition was created in the Data Catalog.
created_bystringThe person or entity who created the table. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
database_namestringThe name of the database where the table metadata resides. For Hive compatibility, this must be all lowercase. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
descriptionstringA description of the table. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>)
federated_tableobjectA FederatedTable structure that references an entity outside the Glue Data Catalog.
iceberg_table_metadataobjectThe latest Apache Iceberg table metadata for the table, including format version, schemas, partition specifications, and sort orders. This field is populated for Iceberg tables and reflects the current state of the table's Iceberg metadata.
is_materialized_viewbooleanIndicates a table is a MaterializedView.
is_multi_dialect_viewbooleanSpecifies whether the view supports the SQL dialects of one or more different query engines and can therefore be read by those engines.
is_registered_with_lake_formationbooleanIndicates whether the table has been registered with Lake Formation.
last_access_timestring (date-time)The last time that the table was accessed. This is usually taken from HDFS, and might not be reliable.
last_analyzed_timestring (date-time)The last time that column statistics were computed for this table.
namestringThe table name. For Hive compatibility, this must be entirely lowercase. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
ownerstringThe owner of the table. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
parametersobjectThese key-value pairs define properties associated with the table.
partition_keysarrayA 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": []
retentionintegerThe retention time for this table.
statusobjectIndicates the the state of an asynchronous change to a table.
storage_descriptorobjectA storage descriptor containing information about the physical storage of this table.
table_typestringThe 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.
target_tableobjectA TableIdentifier structure that describes a target table for resource linking.
update_timestring (date-time)The last time that the table was updated.
version_idstringThe ID of the table version. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
view_definitionobjectA structure that contains all the information that defines the view, including the dialect or dialects for the view, and the query.
view_expanded_textstringIncluded for Apache Hive compatibility. Not used in the normal course of Glue operations.
view_original_textstringIncluded 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.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_tableselectregionRetrieves the Table definition in a Data Catalog for a specified table.
search_tablesselectregionSearches a set of tables based on properties in the table metadata as well as on the parent database. You can search against text or filter conditions. You can only get tables that you have access to based on the security policies defined in Lake Formation. You need at least a read-only access to the table for it to be returned. If you do not have access to all the columns in the table, these columns will not be searched against when returning the list of tables back to you. If you have access to the columns but not the data in the columns, those columns and the associated metadata for those columns will be included in the search.
create_tableinsertregion, DatabaseNameCreates a new table definition in the Data Catalog.
update_tableupdateregion, DatabaseNameUpdates a metadata table in the Data Catalog.
delete_tabledeleteregionRemoves a table definition from the Data Catalog. After completing this operation, you no longer have access to the table versions and partitions that belong to the deleted table. Glue deletes these "orphaned" resources asynchronously in a timely manner, at the discretion of the service. To ensure the immediate deletion of all related resources, before calling DeleteTable, use DeleteTableVersion or BatchDeleteTableVersion, and DeletePartition or BatchDeletePartition, to delete any resources that belong to the table.
get_tablesexecregion, DatabaseNameRetrieves the definitions of some or all of the tables in a given Database.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves the Table definition in a Data Catalog for a specified table.

SELECT
catalog_id,
create_time,
created_by,
database_name,
description,
federated_table,
iceberg_table_metadata,
is_materialized_view,
is_multi_dialect_view,
is_registered_with_lake_formation,
last_access_time,
last_analyzed_time,
name,
owner,
parameters,
partition_keys,
retention,
status,
storage_descriptor,
table_type,
target_table,
update_time,
version_id,
view_definition,
view_expanded_text,
view_original_text
FROM aws.glue.tables
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new table definition in the Data Catalog.

INSERT INTO aws.glue.tables (
CatalogId,
DatabaseName,
Name,
TableInput,
PartitionIndexes,
TransactionId,
OpenTableFormatInput,
region
)
SELECT
'{{ CatalogId }}',
'{{ DatabaseName }}' /* required */,
'{{ Name }}',
'{{ TableInput }}',
'{{ PartitionIndexes }}',
'{{ TransactionId }}',
'{{ OpenTableFormatInput }}',
'{{ region }}'
;

UPDATE examples

Updates a metadata table in the Data Catalog.

UPDATE aws.glue.tables
SET
CatalogId = '{{ CatalogId }}',
DatabaseName = '{{ DatabaseName }}',
Name = '{{ Name }}',
TableInput = '{{ TableInput }}',
SkipArchive = {{ SkipArchive }},
TransactionId = '{{ TransactionId }}',
VersionId = '{{ VersionId }}',
ViewUpdateAction = '{{ ViewUpdateAction }}',
Force = {{ Force }},
UpdateOpenTableFormatInput = '{{ UpdateOpenTableFormatInput }}'
WHERE
region = '{{ region }}' --required
AND DatabaseName = '{{ DatabaseName }}' --required;

DELETE examples

Removes a table definition from the Data Catalog. After completing this operation, you no longer have access to the table versions and partitions that belong to the deleted table. Glue deletes these "orphaned" resources asynchronously in a timely manner, at the discretion of the service. To ensure the immediate deletion of all related resources, before calling DeleteTable, use DeleteTableVersion or BatchDeleteTableVersion, and DeletePartition or BatchDeletePartition, to delete any resources that belong to the table.

DELETE FROM aws.glue.tables
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

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

EXEC aws.glue.tables.get_tables
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"Expression": "{{ Expression }}",
"NextToken": "{{ NextToken }}",
"MaxResults": {{ MaxResults }},
"TransactionId": "{{ TransactionId }}",
"QueryAsOfTime": "{{ QueryAsOfTime }}",
"AuditContext": "{{ AuditContext }}",
"IncludeStatusDetails": {{ IncludeStatusDetails }},
"AttributesToGet": "{{ AttributesToGet }}"
}'
;