Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update Models #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
echo "GH_REPO: $GH_REPO"
echo "GH_ORG: $GH_ORG"
- name: Test Row/Column DBT BQ Checks
uses: org-not-included/dbt_table_diff@v1
uses: org-not-included/dbt_table_diff@v2.2.2
with:
GCP_TOKEN: $GCP_TOKEN
GH_TOKEN: $GH_TOKEN
Expand All @@ -33,4 +33,5 @@ jobs:
prod_prefix: 'prod_'
fallback_prefix: 'fb_'
project_id: 'ultimate-bit-359101'
DBT_PROFILE_FILE: "profile.yml"
DBT_PROFILE_FILE: "profile.yml"
custom_checks_path: "sql_checks"
6 changes: 4 additions & 2 deletions models/example/my_first_dbt_model.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

with source_data as (

select 1 as id
select 7 as new_id
union all
select null as id
select 13 as new_id
union all
select 27 as new_id

)

Expand Down
4 changes: 2 additions & 2 deletions models/example/my_second_dbt_model.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

-- Use the `ref` function to select from other models

select *
select new_id + 1 as newest_id
from {{ ref('my_first_dbt_model') }}
where id = 1
where new_id = 1
11 changes: 11 additions & 0 deletions sql_checks/custom_check.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
with source_info as (
SELECT * FROM `{{ dataset }}.{{ schema }}.__TABLES__` where table_id = '{{table}}'
),
target_info as (
SELECT * FROM `{{ dataset }}.{{ compare_schema }}.__TABLES__` where table_id = '{{table}}'
)
SELECT
source_info.size_bytes as source_size,
target_info.size_bytes as target_size,
source_info.size_bytes - target_info.size_bytes as diff
from source_info, target_info