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 #92

Merged
merged 18 commits into from
Dec 2, 2024

Conversation

fivetran-reneeli
Copy link
Contributor

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

PR Overview

This PR will address the following Issue/Feature: v0.14.0

This PR will result in the following new package version:

Breaking, potential changes to the schema

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

Under the Hood

  • Adds enable config for the upstream metadata staging model (stg_shopify__metafield). For more information on how to enable/disable this table, refer to the README.
  • Adds disable config for the upstream abandoned_checkout staging models (including stg_shopify__abandoned_checkout, stg_shopify__abandoned_checkout_discount_code, and stg_shopify__abandoned_checkout_shipping_line). For more information on how to enable/disable these tables, refer to the README.

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 and voided in the downstream compiled code

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. Please see my change requests and notes below. A number of them reference the source PR so I would recommend reviewing that PR first. Let me know if you have any questions. Thanks!

CHANGELOG.md Outdated
# dbt_shopify v0.14.0

## Under the Hood
- Adds enable config for the upstream `metadata` staging model (`stg_shopify__metafield`). For more information on how to enable/disable this table, refer to the [README](https://github.com/fivetran/dbt_shopify/blob/main/README.md#adding-metafields).
Copy link
Contributor

Choose a reason for hiding this comment

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

See my notes from the source, we will need to rethink the approach taken for the metafields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the approach and documentation, let me know your thoughts!

CHANGELOG.md Outdated

## Under the Hood
- Adds enable config for the upstream `metadata` staging model (`stg_shopify__metafield`). For more information on how to enable/disable this table, refer to the [README](https://github.com/fivetran/dbt_shopify/blob/main/README.md#adding-metafields).
- Adds disable config for the upstream `abandoned_checkout` staging models (including `stg_shopify__abandoned_checkout`, `stg_shopify__abandoned_checkout_discount_code`, and `stg_shopify__abandoned_checkout_shipping_line`). For more information on how to enable/disable these tables, refer to the [README](https://github.com/fivetran/dbt_shopify/blob/main/README.md#step-5-disable-models-for-non-existent-sources).
Copy link
Contributor

Choose a reason for hiding this comment

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

See my source PR review note and make the same updates here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup!

README.md Outdated
@@ -120,7 +120,18 @@ vars:
shopify_using_fulfillment_event: true # false by default
```

### Step 5: Setting your timezone
### Step 5: Disable models for non-existent sources
Copy link
Contributor

Choose a reason for hiding this comment

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

See my note from the source package about consolidating this with the above section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

consolidated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

README.md Outdated
@@ -172,7 +183,7 @@ vars:
```

#### Adding Metafields
In [May 2021](https://fivetran.com/docs/applications/shopify/changelog#may2021) the Shopify connector included support for the [metafield resource](https://shopify.dev/api/admin-rest/2023-01/resources/metafield). If you would like to take advantage of these metafields, this package offers corresponding mapping models which append these metafields to the respective source object for the following tables: collection, customer, order, product_image, product, product_variant, shop. If enabled, these models will materialize as `shopify__[object]_metafields` for each respective supported object. To enable these metafield mapping models, you may use the following configurations within your `dbt_project.yml`.
In [May 2021](https://fivetran.com/docs/applications/shopify/changelog#may2021) the Shopify connector included support for the [metafield resource](https://shopify.dev/api/admin-rest/2023-01/resources/metafield). If you would like to take advantage of these metafields, this package offers corresponding mapping models which append these metafields to the respective source object for the following tables: collection, customer, order, product_image, product, product_variant, shop. Enabling any of the following variables will materialize the `stg_shopify__metafield` model, in addition to respective models that will materialize as `shopify__[object]_metafields` for each respective supported object. To enable these metafield mapping models, you may use the following configurations within your `dbt_project.yml`.
Copy link
Contributor

Choose a reason for hiding this comment

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

See my previous notes about how we should rethink this approach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

shopify_using_fulfillment_event: true
shopify_using_all_metafields: true
shopify__standardized_billing_model_enabled: true
shopify_using_abandoned_checkout: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? Isn't it enabled by default already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes it is, removed

Comment on lines 13 to 15
shopify_using_fulfillment_event: true
shopify_using_all_metafields: true
shopify__standardized_billing_model_enabled: true
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to comment these out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

commented out

@@ -56,7 +57,7 @@ dispatch:
search_order: ['spark_utils', 'dbt_utils']

models:
+schema: "{{ 'shopify_integrations_tests_sqlw' if target.name == 'databricks-sql' else 'shopify' }}"
+schema: "{{ 'shopify_integrations_tests_sqlw' if target.name == 'databricks-sql' else 'shopify_customers_dev' }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops- switched

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

packages.yml Outdated
Comment on lines 2 to 7
# version: [">=0.13.0", "<0.14.0"]

- git: https://github.com/fivetran/dbt_shopify_source.git
revision: bugfix/redshift_constant_expressions
warn-unpinned: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to swap before release

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 great work on this. I have just a few more requests before approval.

CHANGELOG.md Outdated
- `stg_shopify__abandoned_checkout_discount_code`
- `stg_shopify__abandoned_checkout_shipping_line`.
- For more information on how to enable/disable these tables, refer to the [README](https://github.com/fivetran/dbt_shopify/blob/main/README.md#step-4-disable-models-for-non-existent-sources).
- Updates the `index` calculation in `stg_shopify__abandoned_checkout_discount_code` by removing the conditional logic for null scenarios now that a disable config has been added to the model.
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 not relevant for the transform model. We can remove this entry.

Suggested change
- Updates the `index` calculation in `stg_shopify__abandoned_checkout_discount_code` by removing the conditional logic for null scenarios now that a disable config has been added to the model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right! Removed

CHANGELOG.md Outdated
Comment on lines 5 to 9
- Adds enable/disable config for the `metadata` staging model using the `shopify_using_metafield` variable (default `true`).
- Adds enable/disable config for the `abandoned_checkout` staging models using the `shopify_using_abandoned_checkout` variable (default `true`):
- `stg_shopify__abandoned_checkout`
- `stg_shopify__abandoned_checkout_discount_code`
- `stg_shopify__abandoned_checkout_shipping_line`.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also callout the downstream impacts of these variables within this package. For example, the metafield variable is now a requirement in the metafield tables and the abandoned checkout variable will turn off relevant information in X end models.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point,updated

README.md Show resolved Hide resolved
.quickstart/quickstart.yml Show resolved Hide resolved
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 with just one small whitespace suggestion in the CHANGELOG

CHANGELOG.md Outdated Show resolved Hide resolved
@fivetran-reneeli fivetran-reneeli linked an issue Nov 26, 2024 that may be closed by this pull request
4 tasks
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
# dbt_shopify v0.14.0

[PR #92](https://github.com/fivetran/dbt_shopify/pull/92) includes the following updates:
## 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

Same here since this could result in schema changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated!

@fivetran-jamie fivetran-jamie merged commit 295a919 into main Dec 2, 2024
9 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
Development

Successfully merging this pull request may close these issues.

[Documentation] Move badges below H1 heading
4 participants