Created
December 10, 2024 04:25
-
-
Save kenzo0107/b70aef75fadfc6ad49999c73b79217e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CATALOG_ID="AWS Account ID" | |
DATABASE="Glue Data Catalog Database" | |
IAM_ROLE="Execution IAM Role ARN" | |
tables=($(aws glue get-tables --catalog-id $CATALOG_ID \ | |
--database-name $DATABASE \ | |
--query 'TableList[*].Name' --output text)) | |
for table in "${tables[@]}" ; do | |
echo "[ ${table} ]" | |
aws glue create-table-optimizer \ | |
--catalog-id $CATALOG_ID \ | |
--database-name $DATABASE \ | |
--table-name $table \ | |
--table-optimizer-configuration roleArn=$IAM_ROLE,enabled=true \ | |
--type compaction | |
aws glue create-table-optimizer \ | |
--catalog-id $CATALOG_ID \ | |
--database-name $DATABASE \ | |
--table-name $table \ | |
--table-optimizer-configuration roleArn=$IAM_ROLE,enabled=true \ | |
--type retention | |
aws glue create-table-optimizer \ | |
--catalog-id $CATALOG_ID \ | |
--database-name $DATABASE \ | |
--table-name $table \ | |
--table-optimizer-configuration roleArn=$IAM_ROLE,enabled=true \ | |
--type orphan_file_deletion | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment