Skip to content

aws.glue.search_tables

Example SQL Queries

SELECT * FROM
aws.glue.search_tables;

Description

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.

Table Definition

Column NameColumn Data Type
catalog_id Input Column

A unique identifier, consisting of account_id .

VARCHAR
filters Input Column

A list of key-value pairs, and a comparator used to filter the search results. Returns all entities matching the predicate.

The Comparator member of the PropertyPredicate struct is used only for time fields, and can be omitted for other field types. Also, when comparing string values, such as when Key=Name, a fuzzy match algorithm is used. The Key field (for example, the value of the Name field) is split on certain punctuation characters, for example, -, :, #, etc. into tokens. Then each token is exact-match compared with the Value member of PropertyPredicate. For example, if Key=Name and Value=link, tables named customer-link and xx-link-yy are returned, but xxlinkyy is not returned.

STRUCT(
"key" VARCHAR,
"value" VARCHAR,
"comparator" VARCHAR
)[]
Show child fields
filters[]
Show child fields
filters[].comparator

The comparator used to compare this property to others.

filters[].key

The key of the property.

filters[].value

The value of the property.

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
max_results Input Column

The maximum number of tables to return in a single response.

BIGINT
next_token Input Column

A continuation token, present if the current list segment is not the last.

VARCHAR
resource_share_type Input Column

Allows you to specify that you want to search the tables shared with your account. The allowable values are FOREIGN or ALL.

  • If set to FOREIGN, will search the tables shared with your account.

  • If set to ALL, will search the tables shared with your account, as well as the tables in yor local account.

VARCHAR
search_text Input Column

A string used for a text search.

Specifying a value in quotes filters based on an exact match to the value.

VARCHAR
sort_criteria Input Column

A list of criteria for sorting the results by a field name, in an ascending or descending order.

STRUCT(
"field_name" VARCHAR,
"sort" VARCHAR
)[]
Show child fields
sort_criteria[]
Show child fields
sort_criteria[].field_name

The name of the field on which to sort.

sort_criteria[].sort

An ascending or descending sort.

_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_list

A list of the requested Table objects. The SearchTables response returns only the tables that you have access to.

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
)
)[]
)
)
)[]
Show child fields
table_list[]
Show child fields
table_list[].catalog_id

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

table_list[].create_time

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

table_list[].created_by

The person or entity who created the table.

table_list[].database_name

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

table_list[].description

A description of the table.

table_list[].federated_table

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

Show child fields
table_list[].federated_table.connection_name

The name of the connection to the external metastore.

table_list[].federated_table.database_identifier

A unique identifier for the federated database.

table_list[].federated_table.identifier

A unique identifier for the federated table.

table_list[].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_list[].is_registered_with_lake_formation

Indicates whether the table has been registered with Lake Formation.

table_list[].last_access_time

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

table_list[].last_analyzed_time

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

table_list[].name

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

table_list[].owner

The owner of the table.

table_list[].parameters

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

table_list[].partition_keys[]
Show child fields
table_list[].partition_keys[].comment

A free-form text comment.

table_list[].partition_keys[].name

The name of the Column.

table_list[].partition_keys[].parameters

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

table_list[].partition_keys[].type

The data type of the Column.

table_list[].retention

The retention time for this table.

table_list[].status

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

Show child fields
table_list[].status.action

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

table_list[].status.details

A StatusDetails object with information about the requested change.

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

The dialect of the query engine.

table_list[].status.details.view_validations[].dialect_version

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

table_list[].status.details.view_validations[].error

An error associated with the validation.

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

The code associated with this error.

table_list[].status.details.view_validations[].error.error_message

A message describing the error.

table_list[].status.details.view_validations[].state

The state of the validation.

table_list[].status.details.view_validations[].update_time

The time of the last update.

table_list[].status.details.view_validations[].view_validation_text

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

table_list[].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_list[].status.error.error_code

The code associated with this error.

table_list[].status.error.error_message

A message describing the error.

table_list[].status.request_time

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

table_list[].status.requested_by

The ARN of the user who requested the asynchronous change.

table_list[].status.state

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

table_list[].status.update_time

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

table_list[].status.updated_by

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

table_list[].storage_descriptor

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

Show child fields
table_list[].storage_descriptor.additional_locations[]
table_list[].storage_descriptor.bucket_columns[]
table_list[].storage_descriptor.columns[]
Show child fields
table_list[].storage_descriptor.columns[].comment

A free-form text comment.

table_list[].storage_descriptor.columns[].name

The name of the Column.

table_list[].storage_descriptor.columns[].parameters

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

table_list[].storage_descriptor.columns[].type

The data type of the Column.

table_list[].storage_descriptor.compressed

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

table_list[].storage_descriptor.input_format

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

table_list[].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_list[].storage_descriptor.number_of_buckets

Must be specified if the table contains any dimension columns.

table_list[].storage_descriptor.output_format

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

table_list[].storage_descriptor.parameters

The user-supplied properties in key-value form.

table_list[].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_list[].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_list[].storage_descriptor.schema_reference.schema_id.registry_name

The name of the schema registry that contains the schema.

table_list[].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_list[].storage_descriptor.schema_reference.schema_id.schema_name

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

table_list[].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_list[].storage_descriptor.schema_reference.schema_version_number

The version number of the schema.

table_list[].storage_descriptor.serde_info

The serialization/deserialization (SerDe) information.

Show child fields
table_list[].storage_descriptor.serde_info.name

Name of the SerDe.

table_list[].storage_descriptor.serde_info.parameters

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

table_list[].storage_descriptor.serde_info.serialization_library

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

table_list[].storage_descriptor.skewed_info

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

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

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

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

The name of the column.

table_list[].storage_descriptor.sort_columns[].sort_order

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

table_list[].storage_descriptor.stored_as_sub_directories

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

table_list[].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_list[].target_table

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

Show child fields
table_list[].target_table.catalog_id

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

table_list[].target_table.database_name

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

table_list[].target_table.name

The name of the target table.

table_list[].target_table.region

Region of the target table.

table_list[].update_time

The last time that the table was updated.

table_list[].version_id

The ID of the table version.

table_list[].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_list[].view_definition.definer

The definer of a view in SQL.

table_list[].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_list[].view_definition.representations[]
Show child fields
table_list[].view_definition.representations[].dialect

The dialect of the query engine.

table_list[].view_definition.representations[].dialect_version

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

table_list[].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_list[].view_definition.representations[].validation_connection

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

table_list[].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_list[].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_list[].view_definition.sub_objects[]
table_list[].view_expanded_text

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

table_list[].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.