Skip to content

Commit

Permalink
Feature/order to orders (#16)
Browse files Browse the repository at this point in the history
* feature/order-to-orders

* update readme

* updates from pr review

* add order seed

* regen docs

* Update packages.yml
  • Loading branch information
fivetran-catfritz authored Jun 20, 2024
1 parent 5c3584d commit bb801e5
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dbt seed --target "$db" --full-refresh
dbt compile --target "$db"
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{recharge__one_time_product_enabled: false, recharge__address_passthrough_columns: [cart_attribute_id]}' --target "$db" --full-refresh
dbt test --vars '{recharge__one_time_product_enabled: false, recharge__address_passthrough_columns: [cart_attribute_id]}' --target "$db"
dbt run --vars '{recharge_using_orders: false, recharge__one_time_product_enabled: false, recharge__address_passthrough_columns: [cart_attribute_id]}' --target "$db" --full-refresh
dbt test --vars '{recharge_using_orders: false, recharge__one_time_product_enabled: false, recharge__address_passthrough_columns: [cart_attribute_id]}' --target "$db"

dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
42 changes: 10 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,26 @@
**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
- [ ] 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: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# dbt_Recharge_source v0.1.1
# dbt_recharge v0.2.0
[PR #16](https://github.com/fivetran/dbt_recharge/pull/16) includes the following updates:
## Features
- For Fivetran Recharge connectors created on or after June 18, 2024, the `ORDER` source table has been renamed to `ORDERS`. The [dbt_recharge_source](https://github.com/fivetran/dbt_recharge_source) package will now use the `ORDERS` table if it exists and then `ORDER` if not.
- If you have both versions but wish to use the `ORDER` table instead, you can set the variable `recharge__using_orders` to false in your `dbt_project.yml`.
- See the [June 2024 connector release notes](https://fivetran.com/docs/connectors/applications/recharge/changelog#june2024), the [dbt_recharge_source](https://github.com/fivetran/dbt_recharge_source/releases/tag/v0.2.0) release notes, and the related [README section](https://github.com/fivetran/dbt_recharge/blob/main/README.md##leveraging-orders-vs-orders-source) for more details.

## Under the Hood:
- Updated the pull request templates.
- Included auto-releaser GitHub Actions workflow to automate future releases.

# dbt_recharge v0.1.1
[PR #13](https://github.com/fivetran/dbt_recharge/pull/13) includes the following updates:
## Features
- Updated the join logic for `recharge__subscription_overview` to produce more accurate results.
- The [source package](https://github.com/fivetran/dbt_recharge_source/) model `stg_recharge__subscription_history` was updated to use the source's `updated_at` column to determine most recent record. See the source package [CHANGELOG](https://github.com/fivetran/dbt_recharge_source/blob/main/CHANGELOG.md) for more details.

# dbt_Recharge_source v0.1.0
# dbt_recharge v0.1.0
🎉 This is the initial release of this package! 🎉
# 📣 What does this dbt package do?
- Produces modeled tables that leverage Recharge data from [Fivetran's connector](https://fivetran.com/docs/applications/recharge) in the format described by [this ERD](https://fivetran.com/docs/applications/recharge#schemainformation) and build off the output of our [Recharge source package](https://github.com/fivetran/dbt_recharge_source).
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Include the following recharge package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/recharge
version: [">=0.1.0", "<0.2.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=0.2.0", "<0.3.0"] # we recommend using ranges to capture non-breaking changes automatically
```
Do **NOT** include the `recharge_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.

Expand Down Expand Up @@ -75,7 +75,16 @@ vars:
```

## (Optional) Step 5: Additional configurations
<details><summary>Expand for configurations</summary>
<details open><summary>Expand for configurations</summary>

### Leveraging `orders` vs `order` source
For Fivetran Recharge connectors created on or after June 18, 2024, the `ORDER` source table has been renamed to `ORDERS`. Refer to the [June 2024 connector release notes](https://fivetran.com/docs/connectors/applications/recharge/changelog#june2024) for more information.

The package will default to use the `ORDERS` table if it exists and then `ORDER` if not. If you have both versions but wish to use the `ORDER` table instead, you can set the variable `recharge__using_orders` to false in your `dbt_project.yml` file.
```yml
vars:
recharge__using_orders: false # default is true, which will use the `orders` version of the source.
```

### Setting the date range
By default, the models `customer_daily_rollup` and `monthly_recurring_revenue` will aggregate data for the entire date range of your data set. However, you may limit this date range if desired by defining the following variables. You do not need to set both if you only want to limit one.
Expand Down Expand Up @@ -127,7 +136,7 @@ vars:
### 🚨 Snowflake Users 🚨
You may need to provide the case-sensitive spelling of your source tables that are also Snowflake reserved words.

In this package, this would apply to the `ORDER` source. If you are receiving errors for this source, include the following in your `dbt_project.yml` file:
In this package, this would apply to the `ORDER` source. If you are receiving errors for this source, include the following in your `dbt_project.yml` file. (**Note:** This should not be necessary for the `ORDERS` source table.)
```yml
vars:
recharge_order_identifier: '"Order"' # as an example, must include this quoting pattern and adjust for your exact casing
Expand Down Expand Up @@ -158,7 +167,7 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
```yml
packages:
- package: fivetran/recharge_source
version: [">=0.1.0", "<0.2.0"]
version: [">=0.2.0", "<0.3.0"]
- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
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 @@

name: 'recharge'
version: '0.1.1'
version: '0.2.0'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]

Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 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.

7 changes: 6 additions & 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: 'recharge_integration_tests'
version: '0.1.1'
version: '0.2.0'

profile: 'integration_tests'

Expand All @@ -22,6 +22,7 @@ vars:
recharge_one_time_product_identifier: "one_time_product_data"
order: "{{ ref('order_data') }}" # Comment out for generating docs -- Uncomment this before sending to buildkite.
# recharge_order_identifier: "order_data" # Uncomment for generating docs -- Comment this out before sending to buildkite.
recharge_orders_identifier: "orders_data"
recharge_order_line_item_identifier: "order_line_item_data"
recharge_subscription_identifier: "subscription_data"
recharge_subscription_history_identifier: "subscription_history_data"
Expand Down Expand Up @@ -67,6 +68,10 @@ seeds:
ENDS_AT: "timestamp"
STARTS_AT: "timestamp"
order_data:
+column_types:
SHIPPED_DATE: "timestamp"
SHIPPING_DATE: "timestamp"
orders_data:
+column_types:
SHIPPED_DATE: "timestamp"
SHIPPING_DATE: "timestamp"
3 changes: 3 additions & 0 deletions integration_tests/seeds/orders_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ID,CUSTOMER_ID,ADDRESS_ID,CHARGE_ID,IS_DELETED,EMAIL,TRANSACTION_ID,CHARGE_STATUS,IS_PREPAID,STATUS,TOTAL_PRICE,TYPE,EXTERNAL_ORDER_ID_ECOMMERCE,EXTERNAL_ORDER_NUMBER_ECOMMERCE,CREATED_AT,UPDATED_AT,PROCESSED_AT,SCHEDULED_AT,SHIPPED_DATE,_FIVETRAN_SYNCED
11000001,90000001,300000001,400000001,FALSE,[email protected],ch_3La00000000000000000001uS,SUCCESS,FALSE,SUCCESS,14.45,RECURRING,13000001,14000001,2022-08-24T05:27:25Z,2022-08-24T05:27:26Z,2022-08-24T05:27:27Z,2022-08-24T04:00:00Z,2022-08-24T05:27:27Z,2022-08-25T03:57:07.416Z
11000002,90000002,300000002,400000002,FALSE,[email protected],ch_3La00000000000000000002uS,SUCCESS,FALSE,SUCCESS,11.95,RECURRING,13000002,14000002,2022-08-24T05:07:12Z,2022-08-24T05:07:14Z,2022-08-24T05:07:15Z,2022-08-24T04:00:00Z,2022-08-24T05:07:15Z,2022-08-25T03:57:06.225Z
2 changes: 1 addition & 1 deletion packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- package: fivetran/recharge_source
version: [">=0.1.0", "<0.2.0"]
version: [">=0.2.0", "<0.3.0"]

0 comments on commit bb801e5

Please sign in to comment.