Skip to content

Commit

Permalink
customer360 updates -- add customer.phone and remove filter on is_del…
Browse files Browse the repository at this point in the history
…eted (#72)

* stage changes

* changelog

* changelog

* docs and such
  • Loading branch information
fivetran-jamie authored Mar 6, 2024
1 parent d090bb9 commit 1f5823d
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 43 deletions.
43 changes: 11 additions & 32 deletions .github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,27 @@
**This PR will result in the following new package version:**
<!--- Please add details around your decision for breaking vs non-breaking version upgrade. If this is a breaking change, were backwards-compatible options explored? -->

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

## PR Checklist
### Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
- [ ] dbt compile
- [ ] dbt run –full-refresh
- [ ] dbt run
- [ ] dbt test
- [ ] dbt run –vars (if applicable)
- [ ] 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 and tagged
- [ ] You are assigned to the corresponding issue and this PR
- [ ] The appropriate issue has been linked, tagged, and properly assigned
- [ ] All necessary documentation and version upgrades have been applied
<!--- Be sure to update the package version in the dbt_project.yml, integration_tests/dbt_project.yml, and README if necessary. -->
- [ ] 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 acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":
- [ ] You have validated these changes and assure this PR will address the respective Issue/Feature.
- [ ] You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
- [ ] You have provided details below around the validation steps performed to gain confidence in these changes.
Please share any and all of your validation steps:
<!--- Provide the steps you took to validate your changes below. -->

### Standard Updates
Please acknowledge that your PR contains the following standard updates:
- Package versioning has been appropriately indexed in the following locations:
- [ ] indexed within dbt_project.yml
- [ ] indexed within integration_tests/dbt_project.yml
- [ ] CHANGELOG has individual entries for each respective change in this PR
<!--- If there is a parallel upstream change, remember to reference the corresponding CHANGELOG as an individual entry. -->
- [ ] README updates have been applied (if applicable)
<!--- Remember to check the following README locations for common updates. →
<!--- Suggested install range (needed for breaking changes) →
<!--- Dependency matrix is appropriately updated (if applicable) →
<!--- New variable documentation (if applicable) -->
- [ ] DECISIONLOG updates have been updated (if applicable)
- [ ] Appropriate yml documentation has been added (if applicable)

### dbt Docs
Please acknowledge that after the above were all completed the below were applied to your branch:
- [ ] docs were regenerated (unless this PR does not include any code or yml updates)

### If you had to summarize this PR in an emoji, which would it be?
<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) -->
:dancer:
:dancer:
13 changes: 13 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'auto release'
on:
pull_request:
types:
- closed
branches:
- main

jobs:
call-workflow-passing-data:
if: github.event.pull_request.merged
uses: fivetran/dbt_package_automations/.github/workflows/auto-release.yml@main
secrets: inherit
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# dbt_stripe_source v0.11.0
[PR #72](https://github.com/fivetran/dbt_stripe_source/pull/72) includes the following updates:

## 🚨 Breaking Changes 🚨
- 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).

## Feature Updates
- Adds the `phone` column to `stg_stripe__customer`.

## Under the Hood
- Included auto-releaser GitHub Actions workflow to automate future releases.
- Updated the maintainer PR template to resemble the most up to date format.

# 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 docs/catalog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

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,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

0 comments on commit 1f5823d

Please sign in to comment.