diff --git a/.github/workflows/recce_ci.yml b/.github/workflows/recce_ci.yml index c6cde9d..bb10a25 100644 --- a/.github/workflows/recce_ci.yml +++ b/.github/workflows/recce_ci.yml @@ -4,9 +4,35 @@ on: branches: [main] jobs: - check-pull-request: + prepare-artifacts: name: Prepare for Recce runs-on: ubuntu-latest + steps: + - name: Trigger the dbt cloud job and fetch artifacts for Recce + uses: datarecce/dbt-cloud-action@main + id: recce_dbt_cloud_run + with: + dbt_cloud_token: ${{ secrets.DBT_CLOUD_API_TOKEN }} + dbt_cloud_account_id: 62083 + dbt_cloud_base_job_id: 747906 + dbt_cloud_current_job_id: 747907 + failure_on_error: true + + - name: Upload DBT Artifacts for CICD job + uses: actions/upload-artifact@v4 + with: + name: target + path: target/ + + - name: Upload DBT Artifacts for Prod job + uses: actions/upload-artifact@v4 + with: + name: target-base + path: target-base/ + + recce-run: + needs: prepare-artifacts + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: @@ -20,21 +46,17 @@ jobs: - name: Install dependencies run: pip install -r requirements.txt - - name: Trigger the dbt cloud job and fetch artifacts for Recce - uses: datarecce/dbt-cloud-action@main - id: recce_dbt_cloud_run - with: - dbt_cloud_token: ${{ secrets.DBT_CLOUD_API_TOKEN }} - dbt_cloud_account_id: 62083 - dbt_cloud_base_job_id: 747906 - dbt_cloud_current_job_id: 747907 - failure_on_error: true - - uses: "google-github-actions/auth@v2" id: google-auth with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY_JSON }} + - name: Download artifactss + uses: actions/download-artifact@v4 + + - name: Update dbt dependencies + run: dbt deps + - name: Run Recce in cloud mode env: BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }} diff --git a/models/marts/customers.sql b/models/marts/customers.sql index 129eb8f..30736fd 100644 --- a/models/marts/customers.sql +++ b/models/marts/customers.sql @@ -18,7 +18,7 @@ customer_orders_summary as ( orders.customer_id, count(distinct orders.order_id) as count_lifetime_orders, - count(distinct orders.order_id) > 1 as is_repeat_buyer, + count(distinct orders.order_id) > 2 as is_repeat_buyer, min(orders.ordered_at) as first_ordered_at, max(orders.ordered_at) as last_ordered_at, sum(orders.subtotal) as lifetime_spend_pretax,