-
Notifications
You must be signed in to change notification settings - Fork 200
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
Fix fanout in customers model #20
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7eebd6c
Fix fanout in customers model
gwenwindflower 2116691
Tmp fix for issue in data generation of order_items with no order
gwenwindflower b2423fc
Fix source data issues
gwenwindflower 16c38bb
Make cents_to_dollars bq friendly
gwenwindflower 62ca685
Fix bad parens in cents_to_dollars
gwenwindflower ac45a61
Rework cents_to_dollars for BQ syntax
gwenwindflower 20ab39e
Add ruff-cache to gitignore
gwenwindflower 3d5856b
Add dispatch for BQ in cents_to_dollars_macro
gwenwindflower db9ac5e
Minor SQL style updates of column spacing and ordering
gwenwindflower 8be3216
Update deps of sqlfluff pre-commit
gwenwindflower 2997875
Remove temp hurl files
gwenwindflower 7cffd82
Fix accounting for logic issue in source data where order_total is 1c…
gwenwindflower 0d7d1b6
Fix stg_orders as BQ does not support lateral column aliases
gwenwindflower 7057463
Fix source data issue in orders
gwenwindflower 6ff2658
Adjust logic for fixed source data
gwenwindflower File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,11 @@ env | |
target/ | ||
dbt_packages/ | ||
logs/ | ||
profiles.yml | ||
|
||
.DS_Store | ||
|
||
.user.yml | ||
*.hurl | ||
|
||
.ruff_cache | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
{# A basic example for a project-wide macro to cast a column uniformly #} | ||
|
||
{% macro cents_to_dollars(column_name, precision=2) -%} | ||
({{ column_name }} / 100)::numeric(16, {{ precision }}) | ||
{% macro cents_to_dollars(column_name) -%} | ||
{{ return(adapter.dispatch('cents_to_dollars')(column_name)) }} | ||
{%- endmacro %} | ||
|
||
{% macro default__cents_to_dollars(column_name) -%} | ||
({{ column_name }} / 100)::numeric(16, 2) | ||
{%- endmacro %} | ||
|
||
{% macro bigquery__cents_to_dollars(column_name) %} | ||
round(cast(({{ column_name }} / 100) as numeric), 2) | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ order_supplies_summary as ( | |
|
||
select | ||
product_id, | ||
|
||
sum(supply_cost) as supply_cost | ||
|
||
from supplies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ orders as ( | |
|
||
), | ||
|
||
order_items_table as ( | ||
order_items as ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we no longer need to do this renaming as this was for a DuckDB issue |
||
|
||
select * from {{ ref('order_items') }} | ||
|
||
|
@@ -16,14 +16,15 @@ order_items_summary as ( | |
|
||
select | ||
order_id, | ||
|
||
sum(supply_cost) as order_cost, | ||
sum(product_price) as order_items_subtotal, | ||
count(order_item_id) as count_order_items, | ||
sum(case when is_food_item then 1 else 0 end) | ||
as count_food_items, | ||
sum(case when is_drink_item then 1 else 0 end) | ||
as count_drink_items, | ||
|
||
sum(supply_cost) as order_cost | ||
|
||
from order_items_table | ||
as count_drink_items | ||
from order_items | ||
|
||
group by 1 | ||
|
||
|
@@ -33,11 +34,12 @@ order_items_summary as ( | |
compute_booleans as ( | ||
|
||
select | ||
|
||
orders.*, | ||
order_items_summary.order_cost, | ||
order_items_summary.order_items_subtotal, | ||
order_items_summary.count_food_items, | ||
order_items_summary.count_drink_items, | ||
order_items_summary.count_order_items, | ||
order_items_summary.count_food_items > 0 as is_food_order, | ||
order_items_summary.count_drink_items > 0 as is_drink_order | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
packages: | ||
- package: dbt-labs/dbt_utils | ||
version: 1.1.1 | ||
- package: calogica/dbt_date | ||
version: 0.10.0 | ||
- package: dbt-labs/audit_helper | ||
version: 0.10.0 | ||
sha1_hash: ef1c92462efce413655c7e7cbfc1b093c132ef83 | ||
- package: dbt-labs/dbt_utils | ||
version: 1.1.1 | ||
- package: calogica/dbt_date | ||
version: 0.10.0 | ||
- package: dbt-labs/audit_helper | ||
version: 0.11.0 | ||
- package: calogica/dbt_expectations | ||
version: 0.10.3 | ||
sha1_hash: 04cccdda410558cb2751bfe1ee6c1f6f61b60776 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core thing this PR exists to make true