Skip to content

Commit c4949c1

Browse files
Release/v0.12.0 (#82)
* feature/performance-updates * update profile * feature/performance-updates * update materialization * update for redshift * surrogate key for redshift * surrogate key for redshift * update materializations * update materializations * update materializations * update materializations * update changelog, readme, regen docs * update yml * update materializations * update changelog * update changelog * update changelog && regen docs * update changelog * update packages * add databricks sql warehouse * update sql warehouse * update sql warehouse * Remove order discount code filter, add index in (#81) * Remove order discount code filter, add index in * PR fixes * CHANGELOG * CHANGELOG * regen docs * Update packages.yml * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Avinash Kunnath <[email protected]>
1 parent 738491a commit c4949c1

17 files changed

+120
-64
lines changed

.buildkite/hooks/pre-command

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secr
2222
export CI_DATABRICKS_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HOST" --project="dbt-package-testing-363917")
2323
export CI_DATABRICKS_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
2424
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
25-
export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
25+
export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
26+
export CI_DATABRICKS_SQL_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_SQL_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
27+
export CI_DATABRICKS_SQL_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_SQL_DBT_TOKEN" --project="dbt-package-testing-363917")

.buildkite/pipeline.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,19 @@ steps:
7171
- "CI_DATABRICKS_DBT_TOKEN"
7272
- "CI_DATABRICKS_DBT_CATALOG"
7373
commands: |
74-
bash .buildkite/scripts/run_models.sh databricks
74+
bash .buildkite/scripts/run_models.sh databricks
75+
76+
- label: ":databricks: :database: Run Tests - Databricks SQL Warehouse"
77+
key: "run_dbt_databricks_sql"
78+
plugins:
79+
- docker#v3.13.0:
80+
image: "python:3.8"
81+
shell: [ "/bin/bash", "-e", "-c" ]
82+
environment:
83+
- "BASH_ENV=/tmp/.bashrc"
84+
- "CI_DATABRICKS_DBT_HOST"
85+
- "CI_DATABRICKS_SQL_DBT_HTTP_PATH"
86+
- "CI_DATABRICKS_SQL_DBT_TOKEN"
87+
- "CI_DATABRICKS_DBT_CATALOG"
88+
commands: |
89+
bash .buildkite/scripts/run_models.sh databricks-sql

.buildkite/scripts/run_models.sh

+11
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,20 @@ db=$1
1616
echo `pwd`
1717
cd integration_tests
1818
dbt deps
19+
20+
if [ "$db" = "databricks-sql" ]; then
21+
dbt seed --vars '{shopify_schema: shopify_source_integrations_tests_sqlw}' --target "$db" --full-refresh
22+
dbt run --vars '{shopify_schema: shopify_source_integrations_tests_sqlw}' --target "$db" --full-refresh
23+
dbt test --vars '{shopify_schema: shopify_source_integrations_tests_sqlw}' --target "$db"
24+
dbt run --vars '{shopify_schema: shopify_source_integrations_tests_sqlw, shopify_timezone: "America/New_York", shopify_using_fulfillment_event: true}' --target "$db" --full-refresh
25+
dbt test --vars '{shopify_schema: shopify_source_integrations_tests_sqlw}' --target "$db"
26+
dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
27+
28+
else
1929
dbt seed --target "$db" --full-refresh
2030
dbt run --target "$db" --full-refresh
2131
dbt test --target "$db"
2232
dbt run --vars '{shopify_timezone: "America/New_York", shopify_using_fulfillment_event: true}' --target "$db" --full-refresh
2333
dbt test --target "$db"
2434
dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
35+
fi

.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md

+11-32
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,27 @@
44
**This PR will result in the following new package version:**
55
<!--- Please add details around your decision for breaking vs non-breaking version upgrade. If this is a breaking change, were backwards-compatible options explored? -->
66

7-
**Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:**
7+
**Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:**
8+
<!--- Copy/paste the CHANGELOG for this version below. -->
89

910
## PR Checklist
1011
### Basic Validation
1112
Please acknowledge that you have successfully performed the following commands locally:
12-
- [ ] dbt compile
13-
- [ ] dbt run –full-refresh
14-
- [ ] dbt run
15-
- [ ] dbt test
16-
- [ ] dbt run –vars (if applicable)
13+
- [ ] dbt run –full-refresh && dbt test
14+
- [ ] dbt run (if incremental models are present) && dbt test
1715

1816
Before marking this PR as "ready for review" the following have been applied:
19-
- [ ] The appropriate issue has been linked and tagged
20-
- [ ] You are assigned to the corresponding issue and this PR
17+
- [ ] The appropriate issue has been linked, tagged, and properly assigned
18+
- [ ] All necessary documentation and version upgrades have been applied
19+
- [ ] docs were regenerated (unless this PR does not include any code or yml updates)
2120
- [ ] BuildKite integration tests are passing
21+
- [ ] Detailed validation steps have been provided below
2222

2323
### Detailed Validation
24-
Please acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":
25-
- [ ] You have validated these changes and assure this PR will address the respective Issue/Feature.
26-
- [ ] You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
27-
- [ ] You have provided details below around the validation steps performed to gain confidence in these changes.
28-
<!--- Provide the steps you took to validate your changes below. -->
29-
30-
### Standard Updates
31-
Please acknowledge that your PR contains the following standard updates:
32-
- Package versioning has been appropriately indexed in the following locations:
33-
- [ ] indexed within dbt_project.yml
34-
- [ ] indexed within integration_tests/dbt_project.yml
35-
- [ ] CHANGELOG has individual entries for each respective change in this PR
36-
<!--- If there is a parallel upstream change, remember to reference the corresponding CHANGELOG as an individual entry. -->
37-
- [ ] README updates have been applied (if applicable)
38-
<!--- Remember to check the following README locations for common updates. →
39-
<!--- Suggested install range (needed for breaking changes) →
40-
<!--- Dependency matrix is appropriately updated (if applicable) →
41-
<!--- New variable documentation (if applicable) -->
42-
- [ ] DECISIONLOG updates have been updated (if applicable)
43-
- [ ] Appropriate yml documentation has been added (if applicable)
24+
Please share any and all of your validation steps:
4425

45-
### dbt Docs
46-
Please acknowledge that after the above were all completed the below were applied to your branch:
47-
- [ ] docs were regenerated (unless this PR does not include any code or yml updates)
26+
<!--- Provide the steps you took to validate your changes below. -->
4827

4928
### If you had to summarize this PR in an emoji, which would it be?
5029
<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) -->
51-
:dancer:
30+
:dancer:

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
# dbt_shopify_source v0.12.0
2+
3+
[PR #79](https://github.com/fivetran/dbt_shopify_source/pull/79) introduces the following changes:
4+
## 🚨 Breaking Changes 🚨
5+
- To reduce storage, updated default materialization of staging models from tables to views.
6+
- Note that `stg_shopify__metafield` will still be materialized as a table for downstream use.
7+
> ⚠️ Running a `--full-refresh` will be required if you have previously run these staging models as tables and get the following error:
8+
> ```
9+
> Trying to create view <model path> but it currently exists as a table. Either drop <model path> manually, or run dbt with `--full-refresh` and dbt will drop it for you.
10+
> ```
11+
12+
## Under the Hood
13+
- Updated the maintainer PR template to the current format.
14+
- Added integration testing pipeline for Databricks SQL Warehouse.
15+
16+
[PR #81](https://github.com/fivetran/dbt_shopify_source/pull/81) introduces the following changes:
17+
## 🪲 Bug Fixes 🪛
18+
- Removed the `index` filter in `stg_shopify__order_discount_code`, as we were erroneously filtering out multiple discounts for an order since `index` is meant to pair with `order_id` as the unique identifier for this source.
19+
- Added `index` as a field in `stg_shopify__order_discount_code`, as it is part of the primary key.
20+
21+
## 📝 Documentation Updates 📝
22+
- Added `index` documentation to our `src_shopify.yml` and `stg_shopify.yml`.
23+
- Updated the `unique_combination_of_columns` test on `stg_shopify__order_discount_code` to correctly check on `index` with `order_id` and `source_relation` rather than `code`.
24+
25+
## 🔧 Under the Hood 🔩
26+
- Updated the pull request templates.
27+
128
# dbt_shopify_source v0.11.0
229
[PR #78](https://github.com/fivetran/dbt_shopify_source/pull/78) introduces the following changes:
330

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ If you are **not** using the [Shopify transformation package](https://github.co
4444
```yml
4545
packages:
4646
- package: fivetran/shopify_source
47-
version: [">=0.11.0", "<0.12.0"] # we recommend using ranges to capture non-breaking changes automatically
47+
version: [">=0.12.0", "<0.13.0"] # we recommend using ranges to capture non-breaking changes automatically
4848
```
4949

5050
## Step 3: Define database and schema variables

dbt_project.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name: 'shopify_source'
2-
version: '0.11.0'
2+
version: '0.12.0'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55
models:
66
shopify_source:
77
+schema: stg_shopify
8-
+materialized: table
9-
tmp:
10-
+materialized: view
8+
+materialized: view
9+
stg_shopify__metafield:
10+
+materialized: table
11+
1112
vars:
1213
shopify_source:
1314
customer_source: "{{ source('shopify','customer') }}"

docs/catalog.json

+1-1
Large diffs are not rendered by default.

docs/manifest.json

+1-1
Large diffs are not rendered by default.

docs/run_results.json

+1-1
Large diffs are not rendered by default.

integration_tests/ci/sample.profiles.yml

+14-6
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ integration_tests:
1616
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
1717
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
1818
port: 5439
19-
schema: shopify_source_integration_tests_9
19+
schema: shopify_source_integration_tests_10
2020
threads: 8
2121
bigquery:
2222
type: bigquery
2323
method: service-account-json
2424
project: 'dbt-package-testing'
25-
schema: shopify_source_integration_tests_9
25+
schema: shopify_source_integration_tests_10
2626
threads: 8
2727
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
2828
snowflake:
@@ -33,7 +33,7 @@ integration_tests:
3333
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
3434
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
3535
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
36-
schema: shopify_source_integration_tests_9
36+
schema: shopify_source_integration_tests_10
3737
threads: 8
3838
postgres:
3939
type: postgres
@@ -42,13 +42,21 @@ integration_tests:
4242
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
4343
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
4444
port: 5432
45-
schema: shopify_source_integration_tests_8
45+
schema: shopify_source_integration_tests_10
4646
threads: 8
4747
databricks:
4848
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
4949
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
5050
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
51-
schema: shopify_source_integration_tests_9
52-
threads: 2
51+
schema: shopify_source_integration_tests_10
52+
threads: 8
5353
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
5454
type: databricks
55+
databricks-sql:
56+
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
57+
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
58+
http_path: "{{ env_var('CI_DATABRICKS_SQL_DBT_HTTP_PATH') }}"
59+
schema: shopify_source_integrations_tests_sqlw
60+
threads: 8
61+
token: "{{ env_var('CI_DATABRICKS_SQL_DBT_TOKEN') }}"
62+
type: databricks

integration_tests/dbt_project.yml

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
name: 'shopify_source_integration_tests'
2-
version: '0.11.0'
2+
version: '0.12.0'
33
profile: 'integration_tests'
44
config-version: 2
55

66
vars:
7-
shopify_schema: shopify_source_integration_tests_9
7+
shopify_schema: shopify_source_integration_tests_10
8+
# shopify_using_fulfillment_event: true # enable when regenerating docs
89
shopify_source:
9-
shopify_customer_identifier: "shopify_customer_data"
10+
shopify_customer_identifier: "shopify_customer_data"
1011
shopify_order_line_refund_identifier: "shopify_order_line_refund_data"
11-
shopify_order_line_identifier: "shopify_order_line_data"
12-
shopify_order_identifier: "shopify_order_data"
13-
shopify_product_identifier: "shopify_product_data"
14-
shopify_order_adjustment_identifier: "shopify_order_adjustment_data"
15-
shopify_product_variant_identifier: "shopify_product_variant_data"
16-
shopify_refund_identifier: "shopify_refund_data"
17-
shopify_transaction_identifier: "shopify_transaction_data"
12+
shopify_order_line_identifier: "shopify_order_line_data"
13+
shopify_order_identifier: "shopify_order_data"
14+
shopify_product_identifier: "shopify_product_data"
15+
shopify_order_adjustment_identifier: "shopify_order_adjustment_data"
16+
shopify_product_variant_identifier: "shopify_product_variant_data"
17+
shopify_refund_identifier: "shopify_refund_data"
18+
shopify_transaction_identifier: "shopify_transaction_data"
1819
shopify_abandoned_checkout_identifier: "shopify_abandoned_checkout_data"
1920
shopify_collection_product_identifier: "shopify_collection_product_data"
2021
shopify_collection_identifier: "shopify_collection_data"
@@ -45,6 +46,10 @@ dispatch:
4546
- macro_namespace: dbt_utils
4647
search_order: ['spark_utils', 'dbt_utils']
4748

49+
models:
50+
shopify_source:
51+
+schema: "{{ 'shopify_source_integrations_tests_sqlw' if target.name == 'databricks-sql' else 'shopify_source' }}"
52+
4853
seeds:
4954
shopify_source_integration_tests:
5055
+quote_columns: "{{ true if target.type in ('redshift', 'postgres') else false }}"
@@ -130,6 +135,7 @@ seeds:
130135
usage_count: float
131136
shopify_order_discount_code_data:
132137
+column_types:
138+
order_id: "{%- if target.type == 'bigquery' -%} INT64 {%- else -%} bigint {%- endif -%}"
133139
amount: float
134140
shopify_order_shipping_tax_line_data:
135141
+column_types:
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
index,order_id,_fivetran_synced,amount,code,type
2-
1,368347,2022-11-20 08:14:52.957000,11.0,GIFTCARD,percentage
3-
1,423483,2022-11-19 11:59:50.040000,0.0,SHIPPING2022,shipping
4-
1,365403,2022-11-20 10:22:23.877000,2.0,GIFTCARD,percentage
2+
1,2674098602081,2022-11-20 08:14:52.957000,11.0,GIFTCARD,percentage
3+
2,2674098602081,2022-11-20 08:14:52.957000,5.0,SHIPPING2022,shipping
4+
3,2674098602081,2022-11-20 08:14:52.957000,1.0,FIXED,fixed_amount
5+
1,2669516488801,2022-11-19 11:59:50.040000,0.0,SHIPPING2022,shipping
6+
1,2669509541985,2022-11-20 10:22:23.877000,2.0,GIFTCARD,percentage

models/src_shopify.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,8 @@ sources:
13201320
description: Associated order ID.
13211321
- name: type
13221322
description: The type of discount - `fixed_amount`, `percentage`, or `shipping`.
1323+
- name: index
1324+
description: Pairs with `order_id` to provide unique identifier for order discount code.
13231325

13241326
- name: abandoned_checkout_shipping_line
13251327
description: Shipping lines associated with abandoned checkouts.

models/stg_shopify.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ models:
15421542
- dbt_utils.unique_combination_of_columns:
15431543
combination_of_columns:
15441544
- order_id
1545-
- code
1545+
- index
15461546
- source_relation
15471547
columns:
15481548
- name: _fivetran_synced
@@ -1561,6 +1561,9 @@ models:
15611561
description: The type of discount - `fixed_amount`, `percentage`, or `shipping`.
15621562
- name: source_relation
15631563
description: "{{ doc('source_relation') }}"
1564+
- name: index
1565+
description: Pairs with `order_id` to provide unique identifier for order discount code.
1566+
15641567

15651568
- name: stg_shopify__abandoned_checkout_shipping_line
15661569
description: Shipping lines associated with abandoned checkouts.

models/stg_shopify__order_discount_code.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ final as (
2727

2828
select
2929
order_id,
30+
index,
3031
upper(code) as code,
3132
type,
3233
amount,
3334
{{ dbt_date.convert_timezone(column='cast(_fivetran_synced as ' ~ dbt.type_timestamp() ~ ')', target_tz=var('shopify_timezone', "UTC"), source_tz="UTC") }} as _fivetran_synced,
3435
source_relation
3536

3637
from fields
37-
where index = 1 -- Sanity check. index should not > 1 but open an issue if that's not the case in your data
3838
)
3939

4040
select *

packages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ packages:
44
- package: dbt-labs/spark_utils
55
version: [">=0.3.0", "<0.4.0"]
66
- package: calogica/dbt_date
7-
version: [">=0.9.0", "<1.0.0"]
7+
version: [">=0.9.0", "<1.0.0"]

0 commit comments

Comments
 (0)