Skip to content

get_tables

get_tables(
    database_name: NameString,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
    expression: Optional[FilterString] = None,
    next_token: Optional[Token] = None,
    max_results: Optional[CatalogGetterPageSize] = None,
    transaction_id: Optional[TransactionIdString] = None,
    query_as_of_time: Optional[Timestamp] = None,
    audit_context: Optional[AuditContext] = None,
    resource_share_type: Optional[TableResourceShareType] = None,
    include_status_details: Optional[BooleanNullable] = None,
    attributes_to_get: Optional[TableAttributesList] = None,
) -> GetTablesResponse

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

Parameters:

  • catalog_id (Optional[CatalogIdString], default: None ) –

    The ID of the Data Catalog where the tables reside. If none is provided, the Amazon Web Services account ID is used by default.

  • database_name (NameString) –

    The database in the catalog whose tables to list. For Hive compatibility, this name is entirely lowercase.

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

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

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

    A continuation token, included if this is a continuation call.

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

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

  • transaction_id (Optional[TransactionIdString], default: None ) –

    The transaction ID at which to read the table contents.

  • query_as_of_time (Optional[Timestamp], default: None ) –

    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.

  • audit_context (Optional[AuditContext], default: None ) –

    A structure containing the Lake Formation audit context.

  • resource_share_type (Optional[TableResourceShareType], default: None ) –

    Specifies which tables the GetTables call returns. The allowable values are FEDERATED or ALL.

    • If set to FEDERATED, returns only federated tables, which reference an entity outside the Glue Data Catalog.

    • If set to ALL, returns all tables in the database, both federated and non-federated.

  • include_status_details (Optional[BooleanNullable], default: None ) –

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

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

    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.

Raises:

Source code in docs_src/capo_glue/_services/glue.py
def get_tables(
    self,
    database_name: "capo_glue.types.name_string.NameString",
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    catalog_id: Optional[
        "capo_glue.types.catalog_id_string.CatalogIdString"
    ] = None,
    expression: Optional["capo_glue.types.filter_string.FilterString"] = None,
    next_token: Optional["capo_glue.types.token.Token"] = None,
    max_results: Optional[
        "capo_glue.types.catalog_getter_page_size.CatalogGetterPageSize"
    ] = None,
    transaction_id: Optional[
        "capo_glue.types.transaction_id_string.TransactionIdString"
    ] = None,
    query_as_of_time: Optional["capo_glue.types.timestamp.Timestamp"] = None,
    audit_context: Optional["capo_glue.types.audit_context.AuditContext"] = None,
    resource_share_type: Optional[
        "capo_glue.types.table_resource_share_type.TableResourceShareType"
    ] = None,
    include_status_details: Optional[
        "capo_glue.types.boolean_nullable.BooleanNullable"
    ] = None,
    attributes_to_get: Optional[
        "capo_glue.types.table_attributes_list.TableAttributesList"
    ] = None,
) -> "capo_glue.types.get_tables_response.GetTablesResponse":
    """<p>Retrieves the definitions of some or all of the tables in a given <code>Database</code>.</p>

    Args:
        catalog_id: <p>The ID of the Data Catalog where the tables reside. If none is provided, the Amazon Web Services account ID is used by default.</p>
        database_name: <p>The database in the catalog whose tables to list. For Hive compatibility, this name is entirely lowercase.</p>
        expression: <p>A regular expression pattern. If present, only those tables whose names match the pattern are returned.</p>
        next_token: <p>A continuation token, included if this is a continuation call.</p>
        max_results: <p>The maximum number of tables to return in a single response.</p>
        transaction_id: <p>The transaction ID at which to read the table contents.</p>
        query_as_of_time: <p>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 <code>TransactionId</code>.</p>
        audit_context: <p>A structure containing the Lake Formation <a href="https://docs.aws.amazon.com/glue/latest/webapi/API_AuditContext.html">audit context</a>.</p>
        resource_share_type: <p>Specifies which tables the <code>GetTables</code> call returns. The allowable values are <code>FEDERATED</code> or <code>ALL</code>. </p> <ul> <li> <p>If set to <code>FEDERATED</code>, returns only federated tables, which reference an entity outside the Glue Data Catalog.</p> </li> <li> <p>If set to <code>ALL</code>, returns all tables in the database, both federated and non-federated. </p> </li> </ul>
        include_status_details: <p>Specifies whether to include status details related to a request to create or update an Glue Data Catalog view.</p>
        attributes_to_get: <p> Specifies the table fields returned by the <code>GetTables</code> call. This parameter doesn’t accept an empty list. The request must include <code>NAME</code>.</p> <p>The following are the valid combinations of values:</p> <ul> <li> <p> <code>NAME</code> - Names of all tables in the database.</p> </li> <li> <p> <code>NAME</code>, <code>TABLE_TYPE</code> - Names of all tables and the table types.</p> </li> </ul>

    Raises:
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.federation_source_exception.FederationSourceException: <p>A federation source failed.</p>
        capo_glue.errors.federation_source_retryable_exception.FederationSourceRetryableException: <p>A federation source failed, but the operation may be retried.</p>
        capo_glue.errors.glue_encryption_exception.GlueEncryptionException: <p>An encryption operation failed.</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.get_tables_request.GetTablesRequest]",
    ) -> OperationResponse["capo_glue.types.get_tables_response.GetTablesResponse"]:
        import capo_glue._operations.aws_glue.get_tables

        output, http_response = (
            capo_glue._operations.aws_glue.get_tables.get_tables(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetTables")
    )
    input_: capo_glue.types.get_tables_request.GetTablesRequest = {
        "database_name": database_name
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    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 transaction_id is not None:
        input_["transaction_id"] = transaction_id
    if query_as_of_time is not None:
        input_["query_as_of_time"] = query_as_of_time
    if audit_context is not None:
        input_["audit_context"] = audit_context
    if resource_share_type is not None:
        input_["resource_share_type"] = resource_share_type
    if include_status_details is not None:
        input_["include_status_details"] = include_status_details
    if attributes_to_get is not None:
        input_["attributes_to_get"] = attributes_to_get

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output