Skip to content

Commit

Permalink
update cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
maskarb committed Jan 14, 2025
1 parent a5a55b6 commit 5f4fec3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ delete-db:
@$(PREFIX) rm -rf $(TOPDIR)/dev/containers/postgresql/data/

delete-glue-data:
@$(PYTHON) $(SCRIPTDIR)/clean_glue.py
@$(PYTHON) $(SCRIPTDIR)/clean_glue.py $(schema)

delete-test-db:
@PGPASSWORD=$$DATABASE_PASSWORD psql -h $$POSTGRES_SQL_SERVICE_HOST \
Expand Down
16 changes: 12 additions & 4 deletions dev/scripts/clean_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# SPDX-License-Identifier: Apache-2.0
#
"""Clear out our glue testing data."""
import argparse
import os

import boto3


def delete_glue_data():
def delete_glue_data(schema):
bucket_name = os.environ.get("S3_BUCKET_NAME")
schema = f"org{os.environ.get('ORG')}"
credentials = {
"aws_access_key_id": os.environ.get("AWS_ACCESS_KEY_ID"),
"aws_secret_access_key": os.environ.get("AWS_SECRET_ACCESS_KEY"),
"region_name": os.environ.get("S3_REGION"),
"region_name": os.environ.get("S3_REGION") or "us-east-1",
}
path_prefixes = {
"s3_csv_path": f"data/csv/{schema}",
Expand All @@ -39,5 +39,13 @@ def delete_glue_data():
print(f"Failed to delete db: {schema}, its possible it was already deleted: {e}")


def main():
parser = argparse.ArgumentParser()
parser.add_argument("schema")
args = parser.parse_args()

delete_glue_data(args.schema)


if __name__ == "__main__":
delete_glue_data()
main()

0 comments on commit 5f4fec3

Please sign in to comment.