databases
Creates, updates, deletes, gets or lists a databases resource.
Overview
| Name | databases |
| Type | Resource |
| Id | aws.glue.databases |
Fields
The following fields are returned by SELECT queries:
- get_database
| Name | Datatype | Description |
|---|---|---|
catalog_id | string | The 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_permissions | array | Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal course of Glue operations. |
create_time | string (date-time) | The time at which the metadata database was created in the catalog. |
description | string | A description of the database. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>) |
federated_database | object | A FederatedDatabase structure that references an entity outside the Glue Data Catalog. |
location_uri | string | The location of the database (for example, an HDFS path). (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>) |
name | string | The 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>) |
parameters | object | These key-value pairs define parameters and properties of the database. |
target_database | object | A DatabaseIdentifier structure that describes a target database for resource linking. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_database | select | region | Retrieves the definition of a specified database. | |
create_database | insert | region, DatabaseInput | Creates a new database in a Data Catalog. | |
update_database | update | region, DatabaseInput | Updates an existing database definition in a Data Catalog. | |
delete_database | delete | region | 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. | |
batch_create_partition | exec | region, DatabaseName, TableName, PartitionInputList | Creates one or more partitions in a batch operation. | |
batch_delete_partition | exec | region, DatabaseName, TableName, PartitionsToDelete | Deletes one or more partitions in a batch operation. | |
batch_delete_table | exec | region, DatabaseName, TablesToDelete | Deletes 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_version | exec | region, DatabaseName, TableName, VersionIds | Deletes a specified batch of versions of a table. | |
batch_update_partition | exec | region, DatabaseName, TableName, Entries | Updates one or more partitions in a batch operation. | |
get_databases | exec | region | Retrieves all databases defined in a given Data Catalog. | |
start_column_statistics_task_run | exec | region, DatabaseName, TableName, Role | Starts a column statistics task run, for a specified table and columns. | |
start_materialized_view_refresh_task_run | exec | region, CatalogId, DatabaseName, TableName | Starts a materialized view refresh task run for a specified materialized view. | |
stop_column_statistics_task_run | exec | region, DatabaseName, TableName | Stops a task run for the specified table. | |
stop_materialized_view_refresh_task_run | exec | region, CatalogId, DatabaseName, TableName | Stops 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_database
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
- create_database
- Manifest
Creates a new database in a Data Catalog.
INSERT INTO aws.glue.databases (
CatalogId,
DatabaseInput,
Tags,
region
)
SELECT
'{{ CatalogId }}',
'{{ DatabaseInput }}' /* required */,
'{{ Tags }}',
'{{ region }}'
;
# Description fields are for documentation purposes
- name: databases
props:
- name: region
value: "{{ region }}"
description: Required parameter for the databases resource.
- name: CatalogId
value: "{{ CatalogId }}"
description: |
The ID of the Data Catalog in which to create the database. If none is provided, the Amazon Web Services account ID is used by default.
- name: DatabaseInput
description: |
The metadata for the database.
value:
Name: "{{ Name }}"
Description: "{{ Description }}"
LocationUri: "{{ LocationUri }}"
Parameters: "{{ Parameters }}"
CreateTableDefaultPermissions:
- Principal:
DataLakePrincipalIdentifier: "{{ DataLakePrincipalIdentifier }}"
Permissions: "{{ Permissions }}"
TargetDatabase:
CatalogId: "{{ CatalogId }}"
DatabaseName: "{{ DatabaseName }}"
Region: "{{ Region }}"
FederatedDatabase:
Identifier: "{{ Identifier }}"
ConnectionName: "{{ ConnectionName }}"
ConnectionType: "{{ ConnectionType }}"
- name: Tags
value: "{{ Tags }}"
description: |
The tags you assign to the database.
UPDATE examples
- update_database
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
- delete_database
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
- batch_create_partition
- batch_delete_partition
- batch_delete_table
- batch_delete_table_version
- batch_update_partition
- get_databases
- start_column_statistics_task_run
- start_materialized_view_refresh_task_run
- stop_column_statistics_task_run
- stop_materialized_view_refresh_task_run
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 }}"
}'
;
Deletes one or more partitions in a batch operation.
EXEC aws.glue.databases.batch_delete_partition
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}",
"PartitionsToDelete": "{{ PartitionsToDelete }}"
}'
;
Deletes 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.
EXEC aws.glue.databases.batch_delete_table
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TablesToDelete": "{{ TablesToDelete }}",
"TransactionId": "{{ TransactionId }}"
}'
;
Deletes a specified batch of versions of a table.
EXEC aws.glue.databases.batch_delete_table_version
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}",
"VersionIds": "{{ VersionIds }}"
}'
;
Updates one or more partitions in a batch operation.
EXEC aws.glue.databases.batch_update_partition
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}",
"Entries": "{{ Entries }}"
}'
;
Retrieves all databases defined in a given Data Catalog.
EXEC aws.glue.databases.get_databases
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"NextToken": "{{ NextToken }}",
"MaxResults": {{ MaxResults }},
"ResourceShareType": "{{ ResourceShareType }}",
"AttributesToGet": "{{ AttributesToGet }}"
}'
;
Starts a column statistics task run, for a specified table and columns.
EXEC aws.glue.databases.start_column_statistics_task_run
@region='{{ region }}' --required
@@json=
'{
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}",
"ColumnNameList": "{{ ColumnNameList }}",
"Role": "{{ Role }}",
"SampleSize": {{ SampleSize }},
"CatalogID": "{{ CatalogID }}",
"SecurityConfiguration": "{{ SecurityConfiguration }}"
}'
;
Starts a materialized view refresh task run for a specified materialized view.
EXEC aws.glue.databases.start_materialized_view_refresh_task_run
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}",
"FullRefresh": {{ FullRefresh }}
}'
;
Stops a task run for the specified table.
EXEC aws.glue.databases.stop_column_statistics_task_run
@region='{{ region }}' --required
@@json=
'{
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}"
}'
;
Stops a materialized view refresh task run for a specified materialized view.
EXEC aws.glue.databases.stop_materialized_view_refresh_task_run
@region='{{ region }}' --required
@@json=
'{
"CatalogId": "{{ CatalogId }}",
"DatabaseName": "{{ DatabaseName }}",
"TableName": "{{ TableName }}"
}'
;