Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/cleanup-stale-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
- bigquery
- redshift
- databricks_catalog
- athena
steps:
- name: Checkout dbt package
uses: actions/checkout@v4
Expand All @@ -43,7 +42,7 @@ jobs:
run: >
pip install
"dbt-core"
"dbt-${{ (matrix.warehouse-type == 'databricks_catalog' && 'databricks') || (matrix.warehouse-type == 'athena' && 'athena-community') || matrix.warehouse-type }}"
"dbt-${{ (matrix.warehouse-type == 'databricks_catalog' && 'databricks') || matrix.warehouse-type }}"

- name: Write dbt profiles
env:
Expand Down Expand Up @@ -71,3 +70,28 @@ jobs:
dbt run-operation drop_stale_ci_schemas
--args '{prefixes: ["dbt_"], max_age_hours: ${{ inputs.max-age-hours || '24' }}}'
-t "${{ matrix.warehouse-type }}"

cleanup-athena:
runs-on: ubuntu-latest
steps:
- name: Checkout dbt package
uses: actions/checkout@v4
with:
path: dbt-data-reliability

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: "pip"

- name: Install dependencies
run: pip install boto3 click

- name: Drop stale Athena schemas
env:
CI_WAREHOUSE_SECRETS: ${{ secrets.CI_WAREHOUSE_SECRETS || '' }}
run: |
python "${{ github.workspace }}/dbt-data-reliability/integration_tests/ci_tools/athena_drop_schemas.py" \
--stale --prefixes "dbt_" \
--max-age-hours ${{ inputs.max-age-hours || '24' }}
15 changes: 14 additions & 1 deletion .github/workflows/test-warehouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ jobs:
SCHEMA_NAME="dbt_${DATE_STAMP}_${SAFE_BRANCH}_${SHORT_HASH}"

echo "Schema name: $SCHEMA_NAME (branch='${BRANCH_NAME}', timestamp=${DATE_STAMP}, hash of concurrency group)"
echo "SCHEMA_NAME=$SCHEMA_NAME" >> "$GITHUB_ENV"

python "${{ github.workspace }}/dbt-data-reliability/integration_tests/profiles/generate_profiles.py" \
--template "${{ github.workspace }}/dbt-data-reliability/integration_tests/profiles/profiles.yml.j2" \
Expand Down Expand Up @@ -206,10 +207,22 @@ jobs:
- name: Drop test schemas
if: >-
always() &&
contains(fromJSON('["snowflake","bigquery","redshift","databricks_catalog","athena"]'), inputs.warehouse-type)
contains(fromJSON('["snowflake","bigquery","redshift","databricks_catalog"]'), inputs.warehouse-type)
working-directory: ${{ env.TESTS_DIR }}
continue-on-error: true
run: |
${{ (inputs.dbt-version == 'fusion' && '~/.local/bin/dbt') || 'dbt' }} run-operation elementary_tests.drop_test_schemas \
--project-dir dbt_project \
-t "${{ inputs.warehouse-type }}"

- name: Drop test schemas (Athena)
if: >-
always() &&
inputs.warehouse-type == 'athena'
env:
CI_WAREHOUSE_SECRETS: ${{ secrets.CI_WAREHOUSE_SECRETS || '' }}
continue-on-error: true
run: |
pip install boto3 click
python "${{ env.TESTS_DIR }}/ci_tools/athena_drop_schemas.py" \
--ci-test-schemas "$SCHEMA_NAME"
Loading