Skip to content

list_table_metadata async

list_table_metadata(
    catalog_name: CatalogNameString,
    database_name: NameString,
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    expression: Optional[ExpressionString] = None,
    next_token: Optional[Token] = None,
    max_results: Optional[MaxTableMetadataCount] = None,
    work_group: Optional[WorkGroupName] = None,
    attributes_to_get: Optional[TableAttributesList] = None,
) -> ListTableMetadataOutput

Lists the metadata for the tables in the specified data catalog database.

Parameters:

  • catalog_name (CatalogNameString) –

    The name of the data catalog for which table metadata should be returned.

  • database_name (NameString) –

    The name of the database for which table metadata should be returned.

  • expression (Optional[ExpressionString], default: None ) –

    A regex filter that pattern-matches table names. If no expression is supplied, metadata for all tables are listed.

  • next_token (Optional[Token], default: None ) –

    A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.

  • max_results (Optional[MaxTableMetadataCount], default: None ) –

    Specifies the maximum number of results to return.

  • work_group (Optional[WorkGroupName], default: None ) –

    The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.

  • attributes_to_get (Optional[TableAttributesList], default: None ) –

    Specifies the table properties returned by the ListTableMetadata call. This parameter doesn't accept an empty list, and the request must include NAME. The valid combinations of values are NAME, which returns the name of each table, and NAME and TABLE_TYPE, which return the name and table type of each table. The remaining properties are omitted. If you omit this parameter, all table properties are returned.

    Requesting only the properties you need can reduce response time for databases that contain many tables.

    This parameter applies only to the Glue Data Catalog. For other data catalog types, it is ignored.

Raises:

  • InternalServerException –

    Indicates a platform issue, which may be due to a transient condition or outage.

  • InvalidRequestException –

    Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.

  • MetadataException –

    An exception that Athena received when it called a custom metastore. Occurs if the error is not caused by user input (InvalidRequestException) or from the Athena platform (InternalServerException). For example, if a user-created Lambda function is missing permissions, the Lambda 4XX exception is returned in a MetadataException.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_athena/_services/async_athena.py
async def list_table_metadata(
    self,
    catalog_name: "capo_athena.types.catalog_name_string.CatalogNameString",
    database_name: "capo_athena.types.name_string.NameString",
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    expression: Optional[
        "capo_athena.types.expression_string.ExpressionString"
    ] = None,
    next_token: Optional["capo_athena.types.token.Token"] = None,
    max_results: Optional[
        "capo_athena.types.max_table_metadata_count.MaxTableMetadataCount"
    ] = None,
    work_group: Optional["capo_athena.types.work_group_name.WorkGroupName"] = None,
    attributes_to_get: Optional[
        "capo_athena.types.table_attributes_list.TableAttributesList"
    ] = None,
) -> "capo_athena.types.list_table_metadata_output.ListTableMetadataOutput":
    """<p>Lists the metadata for the tables in the specified data catalog database.</p>

    Args:
        catalog_name: <p>The name of the data catalog for which table metadata should be returned.</p>
        database_name: <p>The name of the database for which table metadata should be returned.</p>
        expression: <p>A regex filter that pattern-matches table names. If no expression is supplied, metadata for all tables are listed.</p>
        next_token: <p>A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.</p>
        max_results: <p>Specifies the maximum number of results to return.</p>
        work_group: <p>The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.</p>
        attributes_to_get: <p>Specifies the table properties returned by the <code>ListTableMetadata</code> call. This parameter doesn't accept an empty list, and the request must include <code>NAME</code>. The valid combinations of values are <code>NAME</code>, which returns the name of each table, and <code>NAME</code> and <code>TABLE_TYPE</code>, which return the name and table type of each table. The remaining properties are omitted. If you omit this parameter, all table properties are returned.</p> <p>Requesting only the properties you need can reduce response time for databases that contain many tables.</p> <p>This parameter applies only to the Glue Data Catalog. For other data catalog types, it is ignored.</p>

    Raises:
        capo_athena.errors.internal_server_exception.InternalServerException: <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
        capo_athena.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
        capo_athena.errors.metadata_exception.MetadataException: <p>An exception that Athena received when it called a custom metastore. Occurs if the error is not caused by user input (<code>InvalidRequestException</code>) or from the Athena platform (<code>InternalServerException</code>). For example, if a user-created Lambda function is missing permissions, the Lambda <code>4XX</code> exception is returned in a <code>MetadataException</code>.</p>
        capo_athena.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_athena.types.list_table_metadata_input.ListTableMetadataInput]",
    ) -> AsyncOperationResponse[
        "capo_athena.types.list_table_metadata_output.ListTableMetadataOutput"
    ]:
        import capo_athena._operations.amazon_athena.list_table_metadata

        (
            output,
            http_response,
        ) = await capo_athena._operations.amazon_athena.list_table_metadata.async_list_table_metadata(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListTableMetadata")
    )
    input_: capo_athena.types.list_table_metadata_input.ListTableMetadataInput = {
        "catalog_name": catalog_name,
        "database_name": database_name,
    }
    if expression is not None:
        input_["expression"] = expression
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if work_group is not None:
        input_["work_group"] = work_group
    if attributes_to_get is not None:
        input_["attributes_to_get"] = attributes_to_get

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output