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

customer360 updates -- add customer.phone and remove filter on is_deleted #72

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# dbt_stripe_source v0.11.0
[PR #72](https://github.com/fivetran/dbt_stripe_source/pull/72) includes the following updates:

## Feature Updates
- Adds the `phone` column to `stg_stripe__customer`.
- No longer filters out deleted customers in `stg_stripe__customer`.
- Persists `is_deleted` field to differentiate between deleted and active customers.
- Note that this is a 🚨 breaking change 🚨, as previously filtered-out records will appear in `stg_stripe__customer` (and the downstream transform `stripe__customer_overview` model).
Comment on lines +5 to +7
Copy link
Contributor

Choose a reason for hiding this comment

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

I would actually make this it's own "Breaking Changes" section at the very top to really call this 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.

updated


# dbt_stripe_source v0.10.0
[PR #68](https://github.com/fivetran/dbt_stripe_source/pull/68) includes the following updates:
## Updates
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If you are **not** using the [Stripe transformation package](https://github.com
```yaml
packages:
- package: fivetran/stripe_source
version: [">=0.10.0", "<0.11.0"]
version: [">=0.11.0", "<0.12.0"]
```
## Step 3: Define database and schema variables
By default, this package runs using your destination and the `stripe` schema. If this is not where your stripe data is (for example, if your stripe schema is named `stripe_fivetran`), add the following configuration to your root `dbt_project.yml` file:
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'stripe_source'
version: '0.10.0'
version: '0.11.0'
require-dbt-version: [">=1.3.0", "<2.0.0"]

models:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2

name: 'stripe_source_integration_tests'
version: '0.10.0'
version: '0.11.0'


profile: 'integration_tests'
Expand Down
4 changes: 4 additions & 0 deletions models/src_stripe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ sources:
description: Custom metadata added to the record, in JSON string format
- name: name
description: Customer name.
- name: phone
description: Customer's phone number.
- name: shipping_address_city
description: Attribute of the customer's shipping address.
- name: shipping_address_country
Expand All @@ -250,6 +252,8 @@ sources:
description: Attribute of the customer's shipping address.
- name: livemode
description: Indicates if this is a test customer.
- name: is_deleted
description: Boolean reflecting whether the customer has been deleted in Stripe.

- name: dispute
identifier: "{{ var('stripe_dispute_identifier', 'dispute')}}"
Expand Down
4 changes: 4 additions & 0 deletions models/stg_stripe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ models:
description: Custom metadata added to the record, in JSON string format
- name: customer_name
description: Customer name.
- name: phone
description: Csutomer's phone number.
- name: shipping_address_city
description: Attribute of the customer's shipping address.
- name: shipping_address_country
Expand All @@ -258,6 +260,8 @@ models:
description: Attribute of the customer's shipping address.
- name: source_relation
description: "{{ doc('source_relation') }}"
- name: is_deleted
description: Boolean reflecting whether the customer has been deleted in Stripe.

- name: stg_stripe__fee
description: The details of a fee associated with a balance transaction
Expand Down
6 changes: 3 additions & 3 deletions models/stg_stripe__customer.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ final as (
email,
metadata,
name as customer_name,
phone,
shipping_address_city,
shipping_address_country,
shipping_address_line_1,
Expand All @@ -52,16 +53,15 @@ final as (
shipping_address_state,
shipping_name,
shipping_phone,
source_relation
source_relation,
coalesce(is_deleted, false) as is_deleted

{% if var('stripe__customer_metadata',[]) %}
, {{ fivetran_utils.pivot_json_extract(string = 'metadata', list_of_properties = var('stripe__customer_metadata')) }}
{% endif %}

from fields
{{ livemode_predicate() }}
and
not coalesce(is_deleted, false)
)

select *
Expand Down