Removes a specified database from a Data Catalog.
After completing this operation, you no longer have access to the tables (and all table versions and partitions that might belong to the tables) and the user-defined functions in the deleted database. 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 DeleteDatabase, use DeleteTableVersion or BatchDeleteTableVersion, DeletePartition or BatchDeletePartition, DeleteUserDefinedFunction, and DeleteTable or BatchDeleteTable, to delete any resources that belong to the database.
Parameters:
-
catalog_id
(Optional[CatalogIdString], default:
None
)
–
The ID of the Data Catalog in which the database resides. If none is provided, the Amazon Web Services account ID is used by default.
-
name
(NameString)
–
The name of the database to delete. For Hive compatibility, this must be all lowercase.
Raises:
Source code in docs_src/capo_glue/_services/glue.py
| def delete_database(
self,
name: "capo_glue.types.name_string.NameString",
*,
config_overrides: Optional[GlueClientConfig] = None,
catalog_id: Optional[
"capo_glue.types.catalog_id_string.CatalogIdString"
] = None,
) -> "capo_glue.types.delete_database_response.DeleteDatabaseResponse":
"""<p>Removes a specified database from a Data Catalog.</p> <note> <p>After completing this operation, you no longer have access to the tables (and all table versions and partitions that might belong to the tables) and the user-defined functions in the deleted database. Glue deletes these "orphaned" resources asynchronously in a timely manner, at the discretion of the service.</p> <p>To ensure the immediate deletion of all related resources, before calling <code>DeleteDatabase</code>, use <code>DeleteTableVersion</code> or <code>BatchDeleteTableVersion</code>, <code>DeletePartition</code> or <code>BatchDeletePartition</code>, <code>DeleteUserDefinedFunction</code>, and <code>DeleteTable</code> or <code>BatchDeleteTable</code>, to delete any resources that belong to the database.</p> </note>
Args:
catalog_id: <p>The ID of the Data Catalog in which the database resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
name: <p>The name of the database to delete. For Hive compatibility, this must be all lowercase.</p>
Raises:
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.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.delete_database_request.DeleteDatabaseRequest]",
) -> OperationResponse[
"capo_glue.types.delete_database_response.DeleteDatabaseResponse"
]:
import capo_glue._operations.aws_glue.delete_database
output, http_response = (
capo_glue._operations.aws_glue.delete_database.delete_database(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteDatabase")
)
input_: capo_glue.types.delete_database_request.DeleteDatabaseRequest = {
"name": name
}
if catalog_id is not None:
input_["catalog_id"] = catalog_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|