GitHub Action to delete AWS Glue Data Catalog tables.
- Delete Glue tables
- Automatic verification that table is deleted
- Gracefully handles non-existent tables
- Support for cross-account catalog access
- Comprehensive error reporting
- name: Delete Glue table
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'my_database'
table-name: 'my_table'- name: Delete table in another account
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'shared_database'
table-name: 'shared_table'
catalog-id: '987654321098'This action requires AWS credentials to be configured. Use the official AWS configure credentials action:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
aws-region: us-east-1
- uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'my_database'
table-name: 'my_table'| Input | Required | Default | Description |
|---|---|---|---|
database-name |
Yes | - | Name of the Glue database containing the table |
table-name |
Yes | - | Name of the table to delete |
catalog-id |
No | current account | AWS account ID for cross-account access |
| Output | Description |
|---|---|
table-name |
Name of the deleted table |
database-name |
Name of the database that contained the table |
name: Cleanup Glue Table
on:
workflow_dispatch:
inputs:
database_name:
description: 'Database name'
required: true
table_name:
description: 'Table to delete'
required: true
jobs:
delete-table:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
aws-region: us-east-1
- name: Delete Glue table
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: ${{ github.event.inputs.database_name }}
table-name: ${{ github.event.inputs.table_name }}
id: delete-table
- name: Report deletion
run: |
echo "Table: ${{ steps.delete-table.outputs.table-name }}"
echo "Database: ${{ steps.delete-table.outputs.database-name }}"- name: Delete test table
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'test_database'
table-name: 'test_${{ github.run_id }}'- name: Delete staging tables
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'analytics'
table-name: 'staging_events'
- name: Delete temp table
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'analytics'
table-name: 'temp_results'name: Cleanup on PR Close
on:
pull_request:
types: [closed]
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
aws-region: us-east-1
- name: Delete PR-specific table
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'pr_testing'
table-name: 'pr_${{ github.event.pull_request.number }}_events'- name: Run integration tests
id: tests
run: pytest tests/integration
- name: Cleanup test table
if: always()
uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'test_db'
table-name: 'test_data_${{ github.run_id }}'The AWS credentials used by this action need the following IAM permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"glue:DeleteTable",
"glue:GetTable"
],
"Resource": [
"arn:aws:glue:*:*:catalog",
"arn:aws:glue:*:*:database/*",
"arn:aws:glue:*:*:table/*/*"
]
}
]
}If the table doesn't exist, the action will:
- Log a warning: "Table X.Y does not exist - nothing to delete"
- Exit successfully (not an error)
- Set outputs with table and database names
This makes the action idempotent and safe to run multiple times.
If credentials lack necessary permissions:
- Action will fail with AWS SDK error
- Error details include HTTP status and error code
- Check IAM permissions match requirements above
If the database doesn't exist:
- Action will fail with EntityNotFoundException
- Ensure database exists before attempting to delete tables
- uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'integration_tests'
table-name: 'temp_results'- uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'ephemeral_${{ github.sha }}'
table-name: 'events'# Delete old table
- uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'analytics'
table-name: 'events'
# Create new table with updated schema
- uses: predictr-io/aws-glue-create-table@v0
with:
database-name: 'analytics'
table-name: 'events'
table-input: '{"Name": "events", ...}'# Delete individual tables but keep database
- uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'my_database'
table-name: 'old_table_1'
- uses: predictr-io/aws-glue-delete-table@v0
with:
database-name: 'my_database'
table-name: 'old_table_2'After deletion, the action polls GetTable to verify the table no longer exists:
- Max 10 attempts with 1s delay
- Logs verification progress
- Ensures eventual consistency is handled
- aws-glue-create-table - Create or update Glue tables
- aws-glue-create-database - Create Glue databases
- aws-glue-delete-database - Delete Glue databases (with cascade option for all tables)
MIT