diff --git a/.github/workflows/cd_prod.yml b/.github/workflows/cd_prod.yml index d005ed5..a77a9d2 100644 --- a/.github/workflows/cd_prod.yml +++ b/.github/workflows/cd_prod.yml @@ -53,3 +53,27 @@ jobs: run: uv pip install -r requirements.txt --system - name: Run dbt Cloud job run: python3 .github/workflows/scripts/dbt_cloud_run_job.py + + run_postgres: + name: dbt Cloud Deploy Prod Postgres + runs-on: macos-latest + + env: + DBT_ACCOUNT_ID: 188483 + DBT_PROJECT_ID: 288405 + DBT_PR_JOB_ID: 577871 + DBT_API_KEY: ${{ secrets.DBT_CLOUD_API_KEY }} + DBT_JOB_CAUSE: "GitHub Actions Request" + DBT_JOB_BRANCH: main + + steps: + - uses: "actions/checkout@v4" + - uses: "actions/setup-python@v5" + with: + python-version: "3.12" + - name: Install uv + run: python3 -m pip install uv + - name: Install deps + run: uv pip install -r requirements.txt --system + - name: Run dbt Cloud job + run: python3 .github/workflows/scripts/dbt_cloud_run_job.py diff --git a/.github/workflows/cd_staging.yml b/.github/workflows/cd_staging.yml index e1cf232..b5d161d 100644 --- a/.github/workflows/cd_staging.yml +++ b/.github/workflows/cd_staging.yml @@ -16,7 +16,7 @@ jobs: DBT_PR_JOB_ID: 565266 DBT_API_KEY: ${{ secrets.DBT_CLOUD_API_KEY }} DBT_JOB_CAUSE: "GitHub Actions Request" - DBT_JOB_BRANCH: main + DBT_JOB_BRANCH: staging steps: - uses: "actions/checkout@v4" @@ -40,7 +40,31 @@ jobs: DBT_PR_JOB_ID: 560539 DBT_API_KEY: ${{ secrets.DBT_CLOUD_API_KEY }} DBT_JOB_CAUSE: "GitHub Actions Request" - DBT_JOB_BRANCH: main + DBT_JOB_BRANCH: staging + + steps: + - uses: "actions/checkout@v4" + - uses: "actions/setup-python@v5" + with: + python-version: "3.12" + - name: Install uv + run: python3 -m pip install uv + - name: Install deps + run: uv pip install -r requirements.txt --system + - name: Run dbt Cloud job + run: python3 .github/workflows/scripts/dbt_cloud_run_job.py + + run_postgres: + name: dbt Cloud Deploy Staging Postgres + runs-on: macos-latest + + env: + DBT_ACCOUNT_ID: 188483 + DBT_PROJECT_ID: 288405 + DBT_PR_JOB_ID: 577883 + DBT_API_KEY: ${{ secrets.DBT_CLOUD_API_KEY }} + DBT_JOB_CAUSE: "GitHub Actions Request" + DBT_JOB_BRANCH: staging steps: - uses: "actions/checkout@v4" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8660944..51de57a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,3 +54,28 @@ jobs: run: uv pip install -r requirements.txt --system - name: Run dbt Cloud job run: python3 .github/workflows/scripts/dbt_cloud_run_job.py + + run_postgres: + name: dbt Cloud PR CI Postgres + runs-on: macos-latest + + env: + DBT_ACCOUNT_ID: 188483 + DBT_PROJECT_ID: 288405 + DBT_PR_JOB_ID: 577887 + DBT_API_KEY: ${{ secrets.DBT_CLOUD_API_KEY }} + DBT_JOB_CAUSE: "GitHub Actions Request" + DBT_JOB_BRANCH: ${{ github.head_ref }} + DBT_JOB_SCHEMA_OVERRIDE: dbt_jsdx__pr_${{ github.head_ref}} + + steps: + - uses: "actions/checkout@v4" + - uses: "actions/setup-python@v5" + with: + python-version: "3.12" + - name: Install uv + run: python3 -m pip install uv + - name: Install deps + run: uv pip install -r requirements.txt --system + - name: Run dbt Cloud job + run: python3 .github/workflows/scripts/dbt_cloud_run_job.py diff --git a/dbt_project.yml b/dbt_project.yml index b81b5e6..07bc2a7 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -22,7 +22,6 @@ clean-targets: - "dbt_packages" vars: - truncate_timespan_to: "{{ dbt.cast(dbt.current_timestamp(), 'datetime') }}" "dbt_date:time_zone": "America/Los_Angeles" seeds: diff --git a/models/marts/customers.yml b/models/marts/customers.yml index 127be1a..9836143 100644 --- a/models/marts/customers.yml +++ b/models/marts/customers.yml @@ -1,13 +1,13 @@ models: - name: customers description: Customer overview data mart, offering key details for each unique customer. One row per customer. - tests: + data_tests: - dbt_utils.expression_is_true: expression: "lifetime_spend_pretax + lifetime_tax_paid = lifetime_spend" columns: - name: customer_id description: The unique key of the orders mart. - tests: + data_tests: - not_null - unique - name: customer_name @@ -26,7 +26,7 @@ models: description: The sum of all the order totals (including tax) that a customer has ever placed. - name: customer_type description: Options are 'new' or 'returning', indicating if a customer has ordered more than once or has only placed their first order to date. - tests: + data_tests: - accepted_values: values: ["new", "returning"] diff --git a/models/marts/order_items.yml b/models/marts/order_items.yml index fb9444d..339c476 100644 --- a/models/marts/order_items.yml +++ b/models/marts/order_items.yml @@ -2,11 +2,11 @@ models: - name: order_items columns: - name: order_item_id - tests: + data_tests: - not_null - unique - name: order_id - tests: + data_tests: - relationships: to: ref('orders') field: order_id diff --git a/models/marts/orders.yml b/models/marts/orders.yml index 57ffb41..a37107c 100644 --- a/models/marts/orders.yml +++ b/models/marts/orders.yml @@ -1,7 +1,7 @@ models: - name: orders description: Order overview data mart, offering key details for each order inlcluding if it's a customer's first order and a food vs. drink item breakdown. One row per order. - tests: + data_tests: - dbt_utils.expression_is_true: expression: "order_items_subtotal = subtotal" - dbt_utils.expression_is_true: @@ -9,12 +9,12 @@ models: columns: - name: order_id description: The unique key of the orders mart. - tests: + data_tests: - not_null - unique - name: customer_id description: The foreign key relating to the customer who placed the order. - tests: + data_tests: - relationships: to: ref('stg_customers') field: customer_id diff --git a/models/staging/stg_customers.yml b/models/staging/stg_customers.yml index 1825e5c..3007d14 100644 --- a/models/staging/stg_customers.yml +++ b/models/staging/stg_customers.yml @@ -4,6 +4,6 @@ models: columns: - name: customer_id description: The unique key for each customer. - tests: + data_tests: - not_null - unique diff --git a/models/staging/stg_locations.yml b/models/staging/stg_locations.yml index 03b2fce..0d200c7 100644 --- a/models/staging/stg_locations.yml +++ b/models/staging/stg_locations.yml @@ -4,7 +4,7 @@ models: columns: - name: location_id description: The unique key for each location. - tests: + data_tests: - not_null - unique diff --git a/models/staging/stg_order_items.yml b/models/staging/stg_order_items.yml index 1e2610c..7f8b8be 100644 --- a/models/staging/stg_order_items.yml +++ b/models/staging/stg_order_items.yml @@ -4,12 +4,12 @@ models: columns: - name: order_item_id description: The unique key for each order item. - tests: + data_tests: - not_null - unique - name: order_id description: The corresponding order each order item belongs to - tests: + data_tests: - not_null - relationships: to: ref('stg_orders') diff --git a/models/staging/stg_orders.yml b/models/staging/stg_orders.yml index 7d0bb1a..907c947 100644 --- a/models/staging/stg_orders.yml +++ b/models/staging/stg_orders.yml @@ -1,12 +1,12 @@ models: - name: stg_orders description: Order data with basic cleaning and transformation applied, one row per order. - tests: + data_tests: - dbt_utils.expression_is_true: expression: "order_total - tax_paid = subtotal" columns: - name: order_id description: The unique key for each order. - tests: + data_tests: - not_null - unique diff --git a/models/staging/stg_products.yml b/models/staging/stg_products.yml index 2bc0322..b5d1852 100644 --- a/models/staging/stg_products.yml +++ b/models/staging/stg_products.yml @@ -4,6 +4,6 @@ models: columns: - name: product_id description: The unique key for each product. - tests: + data_tests: - not_null - unique diff --git a/models/staging/stg_supplies.yml b/models/staging/stg_supplies.yml index b173430..3cb4ab0 100644 --- a/models/staging/stg_supplies.yml +++ b/models/staging/stg_supplies.yml @@ -7,6 +7,6 @@ models: columns: - name: supply_uuid description: The unique key of our supplies per cost. - tests: + data_tests: - not_null - unique