databases
Creates, updates, deletes or gets a database resource or lists databases in a region
Overview
| Name | databases |
| Type | Resource |
| Description | Resource Type definition for AWS::Glue::Database |
| Id | awscc.glue.databases |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
catalog_id | string | The AWS account ID for the account in which to create the catalog object. |
database_input | object | The metadata for the database. |
database_name | string | The name of the database. For hive compatibility, this is folded to lowercase when it is store. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
database_name | string | The name of the database. For hive compatibility, this is folded to lowercase when it is store. |
region | string | AWS region. |
For more information, see AWS::Glue::Database.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | databases | INSERT | DatabaseInput, CatalogId, region |
delete_resource | databases | DELETE | Identifier, region |
update_resource | databases | UPDATE | Identifier, PatchDocument, region |
list_resources | databases_list_only | SELECT | region |
get_resource | databases | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual database.
SELECT
region,
catalog_id,
database_input,
database_name
FROM awscc.glue.databases
WHERE
region = 'us-east-1' AND
Identifier = '{{ database_name }}';
Lists all databases in a region.
SELECT
region,
database_name
FROM awscc.glue.databases_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new database resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.glue.databases (
CatalogId,
DatabaseInput,
region
)
SELECT
'{{ catalog_id }}',
'{{ database_input }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.glue.databases (
CatalogId,
DatabaseInput,
DatabaseName,
region
)
SELECT
'{{ catalog_id }}',
'{{ database_input }}',
'{{ database_name }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: database
props:
- name: catalog_id
value: '{{ catalog_id }}'
- name: database_input
value:
location_uri: '{{ location_uri }}'
create_table_default_permissions:
- permissions:
- '{{ permissions[0] }}'
principal:
data_lake_principal_identifier: '{{ data_lake_principal_identifier }}'
description: '{{ description }}'
parameters: {}
target_database:
database_name: '{{ database_name }}'
region: '{{ region }}'
catalog_id: '{{ catalog_id }}'
federated_database:
connection_name: '{{ connection_name }}'
identifier: '{{ identifier }}'
name: '{{ name }}'
- name: database_name
value: '{{ database_name }}'
UPDATE example
Use the following StackQL query and manifest file to update a database resource, using stack-deploy.
/*+ update */
UPDATE awscc.glue.databases
SET PatchDocument = string('{{ {
"CatalogId": catalog_id,
"DatabaseInput": database_input
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ database_name }}';
DELETE example
/*+ delete */
DELETE FROM awscc.glue.databases
WHERE
Identifier = '{{ database_name }}' AND
region = 'us-east-1';
Permissions
To operate on the databases resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
glue:CreateDatabase,
glue:GetDatabase,
glue:PassConnection,
glue:CreateConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
glue:GetDatabase,
glue:GetConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
glue:UpdateDatabase,
glue:UpdateConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
glue:DeleteDatabase,
glue:GetDatabase,
glue:DeleteConnection,
glue:GetConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
glue:GetDatabases,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration