tables
Creates, updates, deletes, gets or lists a tables resource.
Overview
| Name | tables |
| Type | Resource |
| Id | aws.glue.tables |
Fields
The following fields are returned by SELECT queries:
- get_table
- search_tables
| Name | Datatype | Description |
|---|---|---|
catalog_id | string | The ID of the Data Catalog in which the table resides. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>) |
create_time | string (date-time) | The time when the table definition was created in the Data Catalog. |
created_by | string | The person or entity who created the table. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>) |
database_name | string | The 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>) |
description | string | A description of the table. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>) |
federated_table | object | A FederatedTable structure that references an entity outside the Glue Data Catalog. |
iceberg_table_metadata | object | The 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_view | boolean | Indicates a table is a MaterializedView. |
is_multi_dialect_view | boolean | Specifies 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_formation | boolean | Indicates whether the table has been registered with Lake Formation. |
last_access_time | string (date-time) | The last time that the table was accessed. This is usually taken from HDFS, and might not be reliable. |
last_analyzed_time | string (date-time) | The last time that column statistics were computed for this table. |
name | string | The table name. For Hive compatibility, this must be entirely lowercase. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>) |
owner | string | The owner of the table. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>) |
parameters | object | These key-value pairs define properties associated with the table. |
partition_keys | array | 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": [] |
retention | integer | The retention time for this table. |
status | object | Indicates the the state of an asynchronous change to a table. |
storage_descriptor | object | A storage descriptor containing information about the physical storage of this table. |
table_type | string | 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. |
target_table | object | A TableIdentifier structure that describes a target table for resource linking. |
update_time | string (date-time) | The last time that the table was updated. |
version_id | string | The ID of the table version. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>) |
view_definition | object | A structure that contains all the information that defines the view, including the dialect or dialects for the view, and the query. |
view_expanded_text | string | Included for Apache Hive compatibility. Not used in the normal course of Glue operations. |
view_original_text | string | 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. |
| Name | Datatype | Description |
|---|---|---|
next_token | string | A continuation token, present if the current list segment is not the last. |
table_list | array | A list of the requested Table objects. The SearchTables response returns only the tables that you have access to. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_table | select | region | Retrieves the Table definition in a Data Catalog for a specified table. | |
search_tables | select | region | Searches 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_table | insert | region, DatabaseName | Creates a new table definition in the Data Catalog. | |
update_table | update | region, DatabaseName | Updates a metadata table in the Data Catalog. | |
delete_table | delete | region | 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. | |
get_tables | exec | region, DatabaseName | Retrieves 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_table
- search_tables
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
;
Searches 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.
SELECT
next_token,
table_list
FROM aws.glue.tables
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_table
- Manifest
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 }}'
;
# Description fields are for documentation purposes
- name: tables
props:
- name: region
value: "{{ region }}"
description: Required parameter for the tables resource.
- name: CatalogId
value: "{{ CatalogId }}"
description: |
The ID of the Data Catalog in which to create the Table. If none is supplied, the Amazon Web Services account ID is used by default.
- name: DatabaseName
value: "{{ DatabaseName }}"
description: |
The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.
- name: Name
value: "{{ Name }}"
description: |
The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.
- name: TableInput
description: |
The TableInput object that defines the metadata table to create in the catalog.
value:
Name: "{{ Name }}"
Description: "{{ Description }}"
Owner: "{{ Owner }}"
LastAccessTime: "{{ LastAccessTime }}"
LastAnalyzedTime: "{{ LastAnalyzedTime }}"
Retention: {{ Retention }}
StorageDescriptor:
Columns:
- Name: "{{ Name }}"
Type: "{{ Type }}"
Comment: "{{ Comment }}"
Parameters: "{{ Parameters }}"
Location: "{{ Location }}"
AdditionalLocations:
- "{{ AdditionalLocations }}"
InputFormat: "{{ InputFormat }}"
OutputFormat: "{{ OutputFormat }}"
Compressed: {{ Compressed }}
NumberOfBuckets: {{ NumberOfBuckets }}
SerdeInfo:
Name: "{{ Name }}"
SerializationLibrary: "{{ SerializationLibrary }}"
Parameters: "{{ Parameters }}"
BucketColumns:
- "{{ BucketColumns }}"
SortColumns:
- Column: "{{ Column }}"
SortOrder: {{ SortOrder }}
Parameters: "{{ Parameters }}"
SkewedInfo:
SkewedColumnNames:
- "{{ SkewedColumnNames }}"
SkewedColumnValues:
- "{{ SkewedColumnValues }}"
SkewedColumnValueLocationMaps: "{{ SkewedColumnValueLocationMaps }}"
StoredAsSubDirectories: {{ StoredAsSubDirectories }}
SchemaReference:
SchemaId:
SchemaArn: "{{ SchemaArn }}"
SchemaName: "{{ SchemaName }}"
RegistryName: "{{ RegistryName }}"
SchemaVersionId: "{{ SchemaVersionId }}"
SchemaVersionNumber: {{ SchemaVersionNumber }}
PartitionKeys:
- Name: "{{ Name }}"
Type: "{{ Type }}"
Comment: "{{ Comment }}"
Parameters: "{{ Parameters }}"
ViewOriginalText: "{{ ViewOriginalText }}"
ViewExpandedText: "{{ ViewExpandedText }}"
TableType: "{{ TableType }}"
Parameters: "{{ Parameters }}"
TargetTable:
CatalogId: "{{ CatalogId }}"
DatabaseName: "{{ DatabaseName }}"
Name: "{{ Name }}"
Region: "{{ Region }}"
ViewDefinition:
IsProtected: {{ IsProtected }}
Definer: "{{ Definer }}"
Representations:
- Dialect: "{{ Dialect }}"
DialectVersion: "{{ DialectVersion }}"
ViewOriginalText: "{{ ViewOriginalText }}"
ValidationConnection: "{{ ValidationConnection }}"
ViewExpandedText: "{{ ViewExpandedText }}"
ViewVersionId: {{ ViewVersionId }}
ViewVersionToken: "{{ ViewVersionToken }}"
RefreshSeconds: {{ RefreshSeconds }}
LastRefreshType: "{{ LastRefreshType }}"
SubObjects:
- "{{ SubObjects }}"
SubObjectVersionIds:
- {{ SubObjectVersionIds }}
- name: PartitionIndexes
description: |
A list of partition indexes, PartitionIndex structures, to create in the table.
value:
- Keys: "{{ Keys }}"
IndexName: "{{ IndexName }}"
- name: TransactionId
value: "{{ TransactionId }}"
description: |
The ID of the transaction.
- name: OpenTableFormatInput
description: |
Specifies an OpenTableFormatInput structure when creating an open format table.
value:
IcebergInput:
MetadataOperation: "{{ MetadataOperation }}"
Version: "{{ Version }}"
CreateIcebergTableInput:
Location: "{{ Location }}"
Schema:
SchemaId: {{ SchemaId }}
IdentifierFieldIds:
- {{ IdentifierFieldIds }}
Type: "{{ Type }}"
Fields:
- Id: {{ Id }}
Name: "{{ Name }}"
Type: "{{ Type }}"
Required: {{ Required }}
Doc: "{{ Doc }}"
InitialDefault: "{{ InitialDefault }}"
WriteDefault: "{{ WriteDefault }}"
PartitionSpec:
Fields:
- SourceId: {{ SourceId }}
Transform: "{{ Transform }}"
Name: "{{ Name }}"
FieldId: {{ FieldId }}
SpecId: {{ SpecId }}
WriteOrder:
OrderId: {{ OrderId }}
Fields:
- SourceId: {{ SourceId }}
Transform: "{{ Transform }}"
Direction: "{{ Direction }}"
NullOrder: "{{ NullOrder }}"
Properties: "{{ Properties }}"
UPDATE examples
- update_table
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
- delete_table
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
- get_tables
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 }}"
}'
;