Skip to content

Commit

Permalink
Merge pull request #56 from fivetran/bugfix/abandoned-checkout-discou…
Browse files Browse the repository at this point in the history
…nt-id

discount_id issue
  • Loading branch information
fivetran-jamie authored Feb 23, 2023
2 parents f94eb30 + 4a54abe commit 25153c1
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# dbt_shopify_source v0.8.1

## Bug Fixes
- Addresses [Issue #54](https://github.com/fivetran/dbt_shopify_source/issues/54), in which the deprecated `discount_id` field was used instead of `code` in `stg_shopify__abandoned_checkout_discount__code` ([PR #56](https://github.com/fivetran/dbt_shopify_source/pull/56)).

# dbt_shopify_source v0.8.0

Lots of new features ahead!! We've revamped the package to keep up-to-date with new additions to the Shopify connector and feedback from the community.
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'shopify_source'
version: '0.8.0'
version: '0.8.1'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'shopify_source_integration_tests'
version: '0.8.0'
version: '0.8.1'
profile: 'integration_tests'
config-version: 2

Expand Down
2 changes: 1 addition & 1 deletion models/src_shopify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ sources:
- name: created_at
description: When the checkout discount application was created.
- name: discount_id
description: ID of the discount.
description: ID of the discount. Deprecated, use `code` instead.
- name: index
description: Index (from 1) representing the application of the discount to the checkout. Use the latest (highest index)
- name: type
Expand Down
3 changes: 1 addition & 2 deletions models/stg_shopify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,6 @@ models:
combination_of_columns:
- checkout_id
- code
- discount_id
- source_relation
columns:
- name: _fivetran_synced
Expand All @@ -1570,7 +1569,7 @@ models:
- name: created_at
description: When the checkout discount application was created.
- name: discount_id
description: ID of the discount.
description: ID of the discount. Deprecated, use `code` instead.
- name: type
description: The type of discount. Valid values - percentage, shipping, fixed_amount. (default - fixed_amount)
- name: updated_at
Expand Down
7 changes: 4 additions & 3 deletions models/stg_shopify__abandoned_checkout_discount_code.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fields as (
staging_columns=get_abandoned_checkout_discount_code_columns()
)
}}
, row_number() over(partition by checkout_id, discount_id order by index desc) as n

{{ fivetran_utils.source_relation(
union_schema_variable='shopify_union_schemas',
Expand All @@ -34,11 +33,13 @@ final as (
{{ dbt_date.convert_timezone(column='cast(created_at as ' ~ dbt.type_timestamp() ~ ')', target_tz=var('shopify_timezone', "UTC"), source_tz="UTC") }} as created_at,
{{ dbt_date.convert_timezone(column='cast(updated_at as ' ~ dbt.type_timestamp() ~ ')', target_tz=var('shopify_timezone', "UTC"), source_tz="UTC") }} as updated_at,
{{ dbt_date.convert_timezone(column='cast(_fivetran_synced as ' ~ dbt.type_timestamp() ~ ')', target_tz=var('shopify_timezone', "UTC"), source_tz="UTC") }} as _fivetran_synced,
source_relation
source_relation,
row_number() over(partition by checkout_id, upper(code) order by index desc) as index

from fields
where n = 1

)

select *
from final
where index = 1

0 comments on commit 25153c1

Please sign in to comment.