Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# dbt_recharge v1.5.0

[PR #49](https://github.com/fivetran/dbt_recharge/pull/49) includes the following updates:

## Under the Hood
- Migrates the `union_connections`, `apply_source_relation`, and `partition_by_source_relation` macros to the `dbt_fivetran_utils` package.
- Adds the `fivetran_using_source_casing` variable for case-sensitive destination support. When enabled, downstream transformations respect source casing to ensure consistent results. See the [Additional Configurations](https://github.com/fivetran/dbt_recharge/#source-casing-for-case-sensitive-destinations) section of the README for details.

# dbt_recharge v1.4.1

[PR #46](https://github.com/fivetran/dbt_recharge/pull/46) includes the following updates:
Expand Down
55 changes: 14 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Include the following recharge package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/recharge
version: [">=1.4.0", "<1.5.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=1.5.0", "<1.6.0"] # we recommend using ranges to capture non-breaking changes automatically
```
> All required sources and staging models are now bundled into this transformation package. Do not include `fivetran/recharge_source` in your `packages.yml` since this package has been deprecated.

Expand All @@ -93,14 +93,12 @@ dispatch:
```

### Define database and schema variables

#### Option A: Single connection
By default, this package runs using your [destination](https://docs.getdbt.com/docs/running-a-dbt-project/using-the-command-line-interface/configure-your-profile) and the `recharge` schema. If this is not where your Recharge data is (for example, if your Recharge schema is named `recharge_fivetran`), add the following configuration to your root `dbt_project.yml` file:
By default, this package runs using your destination and the `recharge` schema. If this is not where your Recharge data is (for example, if your Recharge schema is named `recharge_fivetran`), add the following configuration to your root `dbt_project.yml` file:

```yml
vars:
recharge:
recharge_database: your_database_name
recharge_database: your_destination_name
recharge_schema: your_schema_name
```

Expand All @@ -124,42 +122,9 @@ vars:
name: connection_2_source_name
```

##### Recommended: Incorporate unioned sources into DAG
> *If you are running the package through [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt#transformationsfordbtcore), the below step is necessary in order to synchronize model runs with your Recharge connections. Alternatively, you may choose to run the package through Fivetran [Quickstart](https://fivetran.com/docs/transformations/quickstart), which would create separate sets of models for each Recharge source rather than one set of unioned models.*

By default, this package defines one single-connection source, called `recharge`, which will be disabled if you are unioning multiple connections. This means that your DAG will not include your Recharge sources, though the package will run successfully.

To properly incorporate all of your Recharge connections into your project's DAG:
1. Define each of your sources in a `.yml` file in your project. Utilize the following template for the `source`-level configurations, and, **most importantly**, copy and paste the table and column-level definitions from the package's `src_recharge.yml` [file](https://github.com/fivetran/dbt_recharge/blob/main/models/staging/src_recharge.yml).

```yml
# a .yml file in your root project
#### Optional: Incorporate unioned sources into DAG

version: 2

sources:
- name: <name> # ex: Should match name in recharge_sources
schema: <schema_name>
database: <database_name>
loader: fivetran
config:
loaded_at_field: _fivetran_synced
freshness: # feel free to adjust to your liking
warn_after: {count: 72, period: hour}
error_after: {count: 168, period: hour}

tables: # copy and paste from recharge/models/staging/src_recharge.yml - see https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/ for how to use anchors to only do so once
```

> **Note**: If there are source tables you do not have (see [Enable/disable models and sources](#enabledisable-models-and-sources)), you may still include them, as long as you have set the right variables to `False`.

2. Set the `has_defined_sources` variable (scoped to the `recharge` package) to `True`, like such:
```yml
# dbt_project.yml
vars:
recharge:
has_defined_sources: true
```
If you use [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt#transformationsfordbtcore) and are unioning multiple Recharge connections, you can define your sources in a property `.yml` file, [using this as a template](https://github.com/fivetran/dbt_recharge/blob/main/models/staging/src_recharge.yml). Set the variable `has_defined_sources: true` under the Recharge namespace in your `dbt_project.yml`. Otherwise, your Recharge connections won't appear in your DAG. See the `union_connections` macro [documentation](https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#optional-union-connections-defined-sources-configuration) for full configuration details.

### Enable/disable models and sources
Your Recharge connection may not sync every table that this package expects. If you do not have the `CHECKOUT`, `ONE_TIME_PRODUCT` and/or `CHARGE_TAX_LINE` tables synced, add the corresponding variable(s) to your root `dbt_project.yml` file to disable these sources:
Expand Down Expand Up @@ -231,6 +196,14 @@ vars:
recharge_<default_source_table_name>_identifier: your_table_name
```

#### Source casing for case-sensitive destinations
By default, the package applies case-insensitive comparisons when resolving `source_relation` values. If your destination is case-sensitive and you want downstream transformations to respect the exact casing of your source database and schema names, set the following variable:

```yml
vars:
fivetran_using_source_casing: true
```

#### Snowflake Users
You may need to provide the case-sensitive spelling of your source tables that are also Snowflake reserved words.

Expand Down Expand Up @@ -289,4 +262,4 @@ This dbt package takes an opinionated stance on revenue is calculated, using cha

## Are there any resources available?
- If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_recharge/issues/new/choose) section to find the right avenue of support for you.
- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).
- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).
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: '1.4.1'
version: '1.5.0'
config-version: 2
require-dbt-version: [">=1.3.0", "<3.0.0"]

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

Large diffs are not rendered by default.

253 changes: 3 additions & 250 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.

8 changes: 7 additions & 1 deletion integration_tests/ci/test_scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ test_scenarios:
- name: "order bool int data"
vars:
recharge_orders_identifier: "order_bool_int_data"
include_incremental: false
include_incremental: false

- name: "MDLS"
vars:
fivetran_using_source_casing: true
include_incremental: false
include_dbt_seed: true
Loading
Loading