Skip to main content

databases

Creates, updates, deletes, gets or lists a databases resource.

Overview

Namedatabases
TypeResource
Idaws.glue.databases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
catalog_idstringThe ID of the Data Catalog in which the database resides. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
create_table_default_permissionsarrayCreates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal course of Glue operations.
create_timestring (date-time)The time at which the metadata database was created in the catalog.
descriptionstringA description of the database. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>)
federated_databaseobjectA FederatedDatabase structure that references an entity outside the Glue Data Catalog.
location_uristringThe location of the database (for example, an HDFS path). (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>)
namestringThe name of the database. For Hive compatibility, this is folded to lowercase when it is stored. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
parametersobjectThese key-value pairs define parameters and properties of the database.
target_databaseobjectA DatabaseIdentifier structure that describes a target database for resource linking.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_databaseselectregionRetrieves the definition of a specified database.
create_databaseinsertregion, DatabaseInputCreates a new database in a Data Catalog.
update_databaseupdateregion, DatabaseInputUpdates an existing database definition in a Data Catalog.
delete_databasedeleteregionRemoves 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.
batch_create_partitionexecregion, DatabaseName, TableName, PartitionInputListCreates one or more partitions in a batch operation.
batch_delete_partitionexecregion, DatabaseName, TableName, PartitionsToDeleteDeletes one or more partitions in a batch operation.
batch_delete_tableexecregion, DatabaseName, TablesToDeleteDeletes multiple tables at once. After completing this operation, you no longer have access to the table versions and partitions that belong to the deleted table. 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 BatchDeleteTable, use DeleteTableVersion or BatchDeleteTableVersion, and DeletePartition or BatchDeletePartition, to delete any resources that belong to the table.
batch_delete_table_versionexecregion, DatabaseName, TableName, VersionIdsDeletes a specified batch of versions of a table.
batch_update_partitionexecregion, DatabaseName, TableName, EntriesUpdates one or more partitions in a batch operation.
get_databasesexecregionRetrieves all databases defined in a given Data Catalog.
start_column_statistics_task_runexecregion, DatabaseName, TableName, RoleStarts a column statistics task run, for a specified table and columns.
start_materialized_view_refresh_task_runexecregion, CatalogId, DatabaseName, TableNameStarts a materialized view refresh task run for a specified materialized view.
stop_column_statistics_task_runexecregion, DatabaseName, TableNameStops a task run for the specified table.
stop_materialized_view_refresh_task_runexecregion, CatalogId, DatabaseName, TableNameStops a materialized view refresh task run for a specified materialized view.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves the definition of a specified database.

SELECT
catalog_id,
create_table_default_permissions,
create_time,
description,
federated_database,
location_uri,
name,
parameters,
target_database
FROM aws.glue.databases
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new database in a Data Catalog.

INSERT INTO aws.glue.databases (
CatalogId,
DatabaseInput,
Tags,
region
)
SELECT
'{{ CatalogId }}',
'{{ DatabaseInput }}' /* required */,
'{{ Tags }}',
'{{ region }}'
;

UPDATE examples

Updates an existing database definition in a Data Catalog.

UPDATE aws.glue.databases
SET
CatalogId = '{{ CatalogId }}',
Name = '{{ Name }}',
DatabaseInput = '{{ DatabaseInput }}'
WHERE
region = '{{ region }}' --required
AND DatabaseInput = '{{ DatabaseInput }}' --required;

DELETE examples

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.

DELETE FROM aws.glue.databases
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Creates one or more partitions in a batch operation.

EXEC aws.glue.databases.batch_create_partition
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}",
"PartitionInputList": "{{ PartitionInputList }}"
}'
;