Skip to content

Commit

Permalink
Add CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-avinash committed Oct 28, 2022
2 parents 47ef54e + 6aadbb0 commit 7585a18
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 10 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ To use this dbt package, you must have the following:
- At least one Fivetran Recurly connector syncing data into your destination.
- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, **Databricks** destination.

### Databricks Dispatch Configuration
If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your `dbt_project.yml`. This is required for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively.
```yml
dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils']
```
## Step 2: Install the package
Include the following recurly_source package version in your `packages.yml` file.
> TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages.
Expand Down Expand Up @@ -57,6 +65,21 @@ vars:
## (Optional) Step 5: Additional configurations
<details><summary>Expand to view configurations</summary>

### Passing Through Additional Fields
This package includes all source columns defined in the macros folder. You can add more columns using our pass-through column variables. These variables allow for the pass-through fields to be aliased (`alias`) and casted (`transform_sql`) if desired, but not required. Datatype casting is configured via a sql snippet within the `transform_sql` key. You may add the desired sql while omitting the `as field_name` at the end and your custom pass-though fields will be casted accordingly. Use the below format for declaring the respective pass-through variables:

```yml
vars:
recurly_account_pass_through_columns:
- name: "new_custom_field"
alias: "custom_field"
transform_sql: "cast(custom_field as string)"
- name: "another_one"
recurly_subscription_pass_through_columns:
- name: "this_field"
alias: "cool_field_name"
```

### Change the build schema
By default, this package builds the recurly staging models within a schema titled (`<target_schema>` + `_recurly_source`) in your destination. If this is not where you would like your recurly staging data to be written to, add the following configuration to your root `dbt_project.yml` file:

Expand Down Expand Up @@ -111,4 +134,4 @@ We highly encourage and welcome contributions to this package. Check out [this d
# 🏪 Are there any resources available?
- If you have questions or want to reach out for help, please refer to the [GitHub Issue](https://github.com/fivetran/dbt_recurly_source/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).
- Have questions or want to just say hi? Book a time during our office hours [on Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at [email protected].
- Have questions or want to just say hi? Book a time during our office hours [on Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at [email protected].
3 changes: 2 additions & 1 deletion models/stg_recurly__account_balance_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ final as (
cast(account_updated_at as {{ dbt_utils.type_timestamp() }}) as account_updated_at,
cast(amount as {{ dbt_utils.type_float() }}) as amount,
currency,
past_due
past_due,
row_number() over (partition by account_id order by account_updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__account_note_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ final as (
message,
object,
user_email,
user_id
user_id,
row_number() over (partition by id order by account_updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__billing_info_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ final as (
payment_method_object,
updated_by_country,
updated_by_ip,
vat_number
vat_number,
row_number() over (partition by id order by updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__credit_payment_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ final as (
original_credit_payment_id,
original_invoice_id,
uuid,
cast(voided_at as {{ dbt_utils.type_timestamp() }}) as voided_at
cast(voided_at as {{ dbt_utils.type_timestamp() }}) as voided_at,
row_number() over (partition by id order by updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__invoice_coupon_redemption_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ final as (
select
coupon_redemption_id,
invoice_id,
cast(invoice_updated_at as {{ dbt_utils.type_timestamp() }}) as invoice_updated_at
cast(invoice_updated_at as {{ dbt_utils.type_timestamp() }}) as invoice_updated_at,
row_number() over (partition by coupon_redemption_id order by invoice_updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__invoice_subscription_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ final as (
select
invoice_id,
cast(invoice_updated_at as {{ dbt_utils.type_timestamp() }}) as invoice_updated_at,
subscription_id
subscription_id,
row_number() over (partition by invoice_id order by invoice_updated_at desc) = 1 as is_most_recent_record
from fields
)
select *
Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__plan_currency_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ final as (
cast(plan_updated_at as {{ dbt_utils.type_timestamp() }}) as plan_updated_at,
currency,
setup_fees,
cast(unit_amount as {{ dbt_utils.type_float() }}) as unit_amount
cast(unit_amount as {{ dbt_utils.type_float() }}) as unit_amount,
row_number() over (partition by plan_id order by plan_updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__subscription_add_on_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ final as (
plan_add_on_id,
quantity,
subscription_id,
cast(unit_amount as {{ dbt_utils.type_float() }}) as unit_amount
cast(unit_amount as {{ dbt_utils.type_float() }}) as unit_amount,
row_number() over (partition by id order by updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down
3 changes: 2 additions & 1 deletion models/stg_recurly__subscription_change_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ final as (
plan_id,
quantity,
subscription_id,
unit_amount
unit_amount,
row_number() over (partition by id order by updated_at desc) = 1 as is_most_recent_record
from fields
)

Expand Down

0 comments on commit 7585a18

Please sign in to comment.