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

Bugfix/redshift constant expressions #91

Merged
merged 18 commits into from
Dec 2, 2024

Conversation

fivetran-reneeli
Copy link
Contributor

@fivetran-reneeli fivetran-reneeli commented Nov 8, 2024

To summarize the internal discussion with the team:

  • after exploring various potential solutions to the Redshift constant expression error and not finding an ideal umbrella outcome for all iterations of this issue, we reached the conclusion that based on the low frequency of this incident, we will be approaching this on a case-by-case basis.
  • For Shopify, the issue can arise due to empty metafield or abandoned_checkout_discount_code tables. Therefore we added enable/disable configs for these so that they may be disabled if not used by the customer.

PR Overview

This PR will address the following Issue/Feature: #90

This PR will result in the following new package version: v0.13.0

Potential changes to schemas

Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:

Under the Hood

  • Adds enable/disable config for the metadata staging model (stg_shopify__metafield).
  • Adds enable/disable config for the abandoned_checkout staging models (including stg_shopify__abandoned_checkout, stg_shopify__abandoned_checkout_discount_code, and stg_shopify__abandoned_checkout_shipping_line).

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt run –full-refresh && dbt test
  • dbt run (if incremental models are present) && dbt test

Before marking this PR as "ready for review" the following have been applied:

  • The appropriate issue has been linked, tagged, and properly assigned
  • All necessary documentation and version upgrades have been applied
  • docs were regenerated (unless this PR does not include any code or yml updates)
  • BuildKite integration tests are passing
  • Detailed validation steps have been provided below

Detailed Validation

Please share any and all of your validation steps:

Recreate the constant expressions error in integration_test folder by running on an empty schema ( ex: shopify_schema: empty). If the upstream table is empty, it should be disabled.

If you had to summarize this PR in an emoji, which would it be?

💃

@fivetran-reneeli fivetran-reneeli self-assigned this Nov 20, 2024
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-reneeli thanks for working through these changes. I have a few change requests and comments below. Let me know if you want to sync on any of these. Particularly if you have any comments around my questions regarding the metafield approach.

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
dbt_project.yml Outdated Show resolved Hide resolved
integration_tests/packages.yml Outdated Show resolved Hide resolved
models/stg_shopify__metafield.sql Outdated Show resolved Hide resolved
models/tmp/stg_shopify__metafield_tmp.sql Outdated Show resolved Hide resolved
@fivetran-reneeli
Copy link
Contributor Author

Thanks @fivetran-joemarkiewicz ! Let me know what you think, especially regarding the new metafield config and the readme updates.

Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-reneeli this is looking great, just a few more changes before approval.

README.md Outdated
Comment on lines 77 to 106
The package takes into consideration that not every Shopify connector may have the `fulfillment_event`, `metadata`, or `abandoned_checkout` tables (including `abandoned_checkout`, `abandoned_checkout_discount_code`, and `abandoned_checkout_shipping_line`) and allows you to enable or disable the corresponding functionality.

The `fulfillment_event` table is **disabled by default** but does hold valuable information that is leveraged in the `shopify__daily_shop` model in the transformation package. If you would like to enable the modeling of fulfillment events downstream, add the following variable to your `dbt_project.yml` file:

Add the following variable to your `dbt_project.yml` file to enable the modeling of fulfillment events:
```yml
# dbt_project.yml

vars:
shopify_using_fulfillment_event: true # false by default
```

The `metadata` table is **enabled by default**. To disable this tables and prevent metadata fields from persisting downstream, add the following variable to your `dbt_project.yml` file:

```yml
# dbt_project.yml

...
vars:
shopify_using_metafield: false #true by default
```

The `abandoned_checkout` tables (including `abandoned_checkout` in addition to the `abandoned_checkout_discount_code` and `abandoned_checkout_shipping_line` child tables) are **enabled by default**. To disable the `abandoned_checkout` tables, add the following variable to your `dbt_project.yml` file:

```yml
# dbt_project.yml

...
vars:
shopify_using_abandoned_checkout: false #true by default
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessarily long and broken out. Let's consolidate them into one enable/disable section like we do in our other packages. For example:

### Step 4: Disable models for non-existent sources

The package takes into consideration that not every Shopify connector may have the `fulfillment_event`, `metadata`, or `abandoned_checkout` tables (including `abandoned_checkout`, `abandoned_checkout_discount_code`, and `abandoned_checkout_shipping_line`) and allows you to enable or disable the corresponding functionality. If you would like to enable/disable the modeling of above mentioned source and their downstream references, add the following variable to your `dbt_project.yml` file:

vars:
    shopify_using_fulfillment_event: true # false by default. Enables the fulfillment_event source
    shopify_using_metafield: false #true by default. Disables the metafield source
    shopify_using_abandoned_checkout: false #true by default. Disables the abandoned_checkout, abandoned_checkout_discount_code, and abandoned_checkout_shipping_line sources

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way it's all in one place and customers don't need to scan over multiple blocks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh good point. I shortened it into 1 section

Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@fivetran-catfritz fivetran-catfritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-reneeli a small suggestion but lgtm!

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
# dbt_shopify_source v0.13.0

[PR #91](https://github.com/fivetran/dbt_shopify_source/pull/91) includes the following changes:
## Under the Hood
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Under the Hood
## Breaking Changes

I would call this or at least part of it "breaking changes" since we bumped the minor version and have no other changes.

fivetran-reneeli and others added 2 commits November 26, 2024 17:26
Co-authored-by: fivetran-catfritz <[email protected]>
@fivetran-jamie fivetran-jamie merged commit de1f561 into main Dec 2, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants