Skip to content

create_table

create_table(
    database_name: NameString,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
    name: Optional[NameString] = None,
    table_input: Optional[TableInput] = None,
    partition_indexes: Optional[PartitionIndexList] = None,
    transaction_id: Optional[TransactionIdString] = None,
    open_table_format_input: Optional[OpenTableFormatInput] = None,
) -> CreateTableResponse

Creates a new table definition in the Data Catalog.

Parameters:

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

    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.

  • database_name (NameString) –

    The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.

  • name (Optional[NameString], default: None ) –

    The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.

  • table_input (Optional[TableInput], default: None ) –

    The TableInput object that defines the metadata table to create in the catalog.

  • partition_indexes (Optional[PartitionIndexList], default: None ) –

    A list of partition indexes, PartitionIndex structures, to create in the table.

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

    The ID of the transaction.

  • open_table_format_input (Optional[OpenTableFormatInput], default: None ) –

    Specifies an OpenTableFormatInput structure when creating an open format table.

Raises:

Source code in docs_src/capo_glue/_services/glue.py
def create_table(
    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,
    name: Optional["capo_glue.types.name_string.NameString"] = None,
    table_input: Optional["capo_glue.types.table_input.TableInput"] = None,
    partition_indexes: Optional[
        "capo_glue.types.partition_index_list.PartitionIndexList"
    ] = None,
    transaction_id: Optional[
        "capo_glue.types.transaction_id_string.TransactionIdString"
    ] = None,
    open_table_format_input: Optional[
        "capo_glue.types.open_table_format_input.OpenTableFormatInput"
    ] = None,
) -> "capo_glue.types.create_table_response.CreateTableResponse":
    """<p>Creates a new table definition in the Data Catalog.</p>

    Args:
        catalog_id: <p>The ID of the Data Catalog in which to create the <code>Table</code>. If none is supplied, the Amazon Web Services account ID is used by default.</p>
        database_name: <p>The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.</p>
        name: <p>The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.</p>
        table_input: <p>The <code>TableInput</code> object that defines the metadata table to create in the catalog.</p>
        partition_indexes: <p>A list of partition indexes, <code>PartitionIndex</code> structures, to create in the table.</p>
        transaction_id: <p>The ID of the transaction.</p>
        open_table_format_input: <p>Specifies an <code>OpenTableFormatInput</code> structure when creating an open format table.</p>

    Raises:
        capo_glue.errors.already_exists_exception.AlreadyExistsException: <p>A resource to be created or added already exists.</p>
        capo_glue.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</p>
        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.resource_not_ready_exception.ResourceNotReadyException: <p>A resource was not ready for a transaction.</p>
        capo_glue.errors.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.create_table_request.CreateTableRequest]",
    ) -> OperationResponse[
        "capo_glue.types.create_table_response.CreateTableResponse"
    ]:
        import capo_glue._operations.aws_glue.create_table

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTable")
    )
    input_: capo_glue.types.create_table_request.CreateTableRequest = {
        "database_name": database_name
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if name is not None:
        input_["name"] = name
    if table_input is not None:
        input_["table_input"] = table_input
    if partition_indexes is not None:
        input_["partition_indexes"] = partition_indexes
    if transaction_id is not None:
        input_["transaction_id"] = transaction_id
    if open_table_format_input is not None:
        input_["open_table_format_input"] = open_table_format_input

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