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 | aws.glue.databases |
Fields
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. |
For more information, see AWS::Glue::Database
.
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | DatabaseInput, CatalogId, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all databases
in a region.
SELECT
region,
catalog_id,
database_input,
database_name
FROM aws.glue.databases
WHERE region = 'us-east-1';
Gets all properties from an individual database
.
SELECT
region,
catalog_id,
database_input,
database_name
FROM aws.glue.databases
WHERE region = 'us-east-1' AND data__Identifier = '<DatabaseName>';
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 aws.glue.databases (
CatalogId,
DatabaseInput,
region
)
SELECT
'{{ CatalogId }}',
'{{ DatabaseInput }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.glue.databases (
CatalogId,
DatabaseInput,
DatabaseName,
region
)
SELECT
'{{ CatalogId }}',
'{{ DatabaseInput }}',
'{{ DatabaseName }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: database
props:
- name: CatalogId
value: '{{ CatalogId }}'
- name: DatabaseInput
value:
LocationUri: '{{ LocationUri }}'
CreateTableDefaultPermissions:
- Permissions:
- '{{ Permissions[0] }}'
Principal:
DataLakePrincipalIdentifier: '{{ DataLakePrincipalIdentifier }}'
Description: '{{ Description }}'
Parameters: {}
TargetDatabase:
DatabaseName: '{{ DatabaseName }}'
Region: '{{ Region }}'
CatalogId: '{{ CatalogId }}'
FederatedDatabase:
ConnectionName: '{{ ConnectionName }}'
Identifier: '{{ Identifier }}'
Name: '{{ Name }}'
- name: DatabaseName
value: '{{ DatabaseName }}'
DELETE
example
/*+ delete */
DELETE FROM aws.glue.databases
WHERE data__Identifier = '<DatabaseName>'
AND region = 'us-east-1';
Permissions
To operate on the databases
resource, the following permissions are required:
Create
glue:CreateDatabase,
glue:GetDatabase,
glue:PassConnection,
glue:CreateConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
Read
glue:GetDatabase,
glue:GetConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
Update
glue:UpdateDatabase,
glue:UpdateConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
Delete
glue:DeleteDatabase,
glue:GetDatabase,
glue:DeleteConnection,
glue:GetConnection,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration
List
glue:GetDatabases,
lakeformation:ListResources,
lakeformation:DescribeResource,
lakeformation:DescribeLakeFormationIdentityCenterConfiguration