Skip to content

Commit

Permalink
Refactor dbt-sqlite tests to use dbt-postgres (#1366)
Browse files Browse the repository at this point in the history
closes: #1341

previously ran SQLite tests with dbt-core version 1.4, which has reached
its end of life. Recently, these tests have started failing. Since we
rely on the repo: https://github.com/codeforkjeff/dbt-sqlite/ for
running the tests, and it is no longer actively maintained, this PR
performs the necessary cleanup to address the issue

- Point the sqlite test to use Postgres
- Remove CI workflow job: Run-Integration-Tests-Sqlite
- Remove hatch target: hatch run
tests.py3.12-2.10:test-integration-sqlite-setup and hatch run
tests.py3.12-2.10:test-integration-sqlite
- Remove pytest marker `sqlite`
- Remove dbt project simple
- Update manifest file
  • Loading branch information
pankajastro authored Dec 10, 2024
1 parent 534c4a2 commit be07ccf
Show file tree
Hide file tree
Showing 30 changed files with 13,636 additions and 3,321 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,76 +267,6 @@ jobs:
AIRFLOW_CONN_DATABRICKS_DEFAULT: ${{ secrets.AIRFLOW_CONN_DATABRICKS_DEFAULT }}
DATABRICKS_CLUSTER_ID: ${{ secrets.DATABRICKS_CLUSTER_ID }}

# TODO: https://github.com/astronomer/astronomer-cosmos/issues/1341
# Run-Integration-Tests-Sqlite:
# needs: Authorize
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.11"]
# airflow-version: ["2.8"]
#
# steps:
# - uses: actions/checkout@v3
# with:
# ref: ${{ github.event.pull_request.head.sha || github.ref }}
# - uses: actions/cache@v3
# with:
# path: |
# ~/.cache/pip
# .local/share/hatch/
# key: integration-sqlite-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('cosmos/__init__.py') }}
#
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
#
# - name: Install packages and dependencies
# run: |
# python -m pip install uv
# uv pip install --system hatch
# hatch -e tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }} run pip freeze
#
# - name: Test Cosmos against Airflow ${{ matrix.airflow-version }} and Python ${{ matrix.python-version }}
# run: |
# hatch run tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}:test-integration-sqlite-setup
# hatch run tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}:test-integration-sqlite
# env:
# AIRFLOW_HOME: /home/runner/work/astronomer-cosmos/astronomer-cosmos/
# AIRFLOW_CONN_EXAMPLE_CONN: postgres://postgres:[email protected]:5432/postgres
# AIRFLOW_CONN_AWS_S3_CONN: ${{ secrets.AIRFLOW_CONN_AWS_S3_CONN }}
# AIRFLOW_CONN_GCP_GS_CONN: ${{ secrets.AIRFLOW_CONN_GCP_GS_CONN }}
# AIRFLOW_CONN_AZURE_ABFS_CONN: ${{ secrets.AIRFLOW_CONN_AZURE_ABFS_CONN }}
# AIRFLOW__CORE__DAGBAG_IMPORT_TIMEOUT: 90.0
# PYTHONPATH: /home/runner/work/astronomer-cosmos/astronomer-cosmos/:$PYTHONPATH
# AIRFLOW__COSMOS__ENABLE_CACHE: 0
# COSMOS_CONN_POSTGRES_PASSWORD: ${{ secrets.COSMOS_CONN_POSTGRES_PASSWORD }}
# DATABRICKS_CLUSTER_ID: mock
# DATABRICKS_HOST: mock
# DATABRICKS_WAREHOUSE_ID: mock
# DATABRICKS_TOKEN: mock
# POSTGRES_HOST: localhost
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: postgres
# POSTGRES_SCHEMA: public
# POSTGRES_PORT: 5432
# AIRFLOW__COSMOS__REMOTE_TARGET_PATH: "s3://cosmos-remote-cache/target_compiled/"
# AIRFLOW__COSMOS__REMOTE_TARGET_PATH_CONN_ID: aws_s3_conn
#
# - name: Upload coverage to Github
# uses: actions/upload-artifact@v4
# with:
# name: coverage-integration-sqlite-test-${{ matrix.python-version }}-${{ matrix.airflow-version }}
# path: .coverage
# include-hidden-files: true
#
# env:
# AIRFLOW_HOME: /home/runner/work/astronomer-cosmos/astronomer-cosmos/
# AIRFLOW_CONN_EXAMPLE_CONN: postgres://postgres:[email protected]:5432/postgres
# PYTHONPATH: /home/runner/work/astronomer-cosmos/astronomer-cosmos/:$PYTHONPATH

Run-Integration-Tests-DBT-1-5-4:
needs: Authorize
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
types: [text]
args:
- --exclude-file=tests/sample/manifest_model_version.json
- --skip=**/manifest.json,**.min.js
- --skip=**/manifest.json,**.min.js,**/manifest_source.json
- -L connexion,aci
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exposures:
type: dashboard
maturity: high
depends_on:
- ref('top_animations')
- ref('customers')
owner:
name: Cosmos Team
email: [email protected]
6 changes: 6 additions & 0 deletions dev/dags/dbt/jaffle_shop/models/orders.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{{ config(
materialized='view',
alias=var('orders_alias', 'orders')
)
}}

{% set payment_methods = ['credit_card', 'coupon', 'bank_transfer', 'gift_card'] %}

with orders as (
Expand Down
2 changes: 1 addition & 1 deletion dev/dags/dbt/jaffle_shop/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ postgres_profile:
outputs:
dev:
type: postgres
dbname: "{{ env_var('POSTGRES_DATABASE') }}"
dbname: "{{ env_var('POSTGRES_DB') }}"
host: "{{ env_var('POSTGRES_HOST') }}"
pass: "{{ env_var('POSTGRES_PASSWORD') }}"
port: 5432 # "{{ env_var('POSTGRES_PORT') | as_number }}"
Expand Down
Loading

0 comments on commit be07ccf

Please sign in to comment.