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
2 changes: 1 addition & 1 deletion .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 source freshness --target "$db" || echo "...Only verifying freshness runs..."
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{using_credit_card_payment_txn: true, using_address: false, using_bill: false, using_credit_memo: false, using_department: false, using_deposit: false, using_estimate: false, using_invoice: false, using_invoice_bundle: false, using_journal_entry: false, using_payment: false, using_refund_receipt: false, using_transfer: false, using_vendor_credit: false, using_sales_receipt: false}' --target "$db" --full-refresh
dbt run --vars '{using_credit_card_payment_txn: true, using_address: false, using_bill: false, using_credit_memo: false, using_department: false, using_deposit: false, using_estimate: false, using_invoice: false, using_invoice_bundle: false, using_invoice_tax_line: true, using_journal_entry: false, using_journal_entry_tax_line: true, using_payment: false, using_purchase_tax_line: true, using_refund_receipt: false, using_refund_receipt_tax_line: true, using_sales_receipt: false, using_sales_receipt_tax_line: true, using_tax_agency: true, using_tax_rate: true, using_transfer: false, using_vendor_credit: false}' --target "$db" --full-refresh
dbt test --target "$db"

dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
93 changes: 93 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion DECISIONLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,16 @@ Please leverage the below fields in your end models for your financial statement
| [quickbooks__balance_sheet](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__balance_sheet) | `converted_amount` | `amount` |
| [quickbooks__cash_flow_statement](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__cash_flow_statement) | `cash_converted_ending_period`, `cash_converted_beginning_period`, `cash_converted_net_period` | `cash_ending_period`, `cash_beginning_period`, `cash_net_period` |
| [quickbooks__ap_ar_enhanced](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__ap_ar_enhanced) | `total_converted_amount`, `estimate_total_converted_amount`, `total_current_converted_payment` | `total_amount`, `estimate_total_amount`, `total_current_payment` |
| [quickbooks__expenses_sales_enhanced](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__expenses_sales_enhanced) | `total_converted_amount`, `converted_amount` | `total_amount`, `amount` |
| [quickbooks__expenses_sales_enhanced](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__expenses_sales_enhanced) | `total_converted_amount`, `converted_amount` | `total_amount`, `amount` |


## Bringing in The Right Tax Accounts For Tax Lines
When bringing in tax lines ([see the README](https://github.com/fivetran/dbt_quickbooks?tab=readme-ov-file#step-4-enablingdisabling-models) for more details on how to enable/disable tax lines), we want to make sure we are associating each line with the right account, since they usually differ from the accounts for the regular lines. That way these lines are correctly tracked, generally as liabilities.

Our initial logic maps the tax agency display name by appending 'Payable' to the end of the name. That should ideally match one account name, which is the appropriate account for that tax line. Multiple tax accounts with the same name would cause fanout.

If tax agencies aren't where you want your mapping to take place, we then search for your default `Sales Tax Payable` and `Global Tax Payable` account available in your Quickbooks account. [See this Quickbooks article for more details](https://quickbooks.intuit.com/learn-support/en-ca/taxes/separate-tax-remittance-accounts/00/740623).

If neither of those accounts are available, the `quickbooks__sales_tax_account_reference` and `quickbooks__global_tax_account_reference` variables are made available to publish the account name you believe matches the tax line. [See the README for more details](https://github.com/fivetran/dbt_quickbooks?tab=readme-ov-file#configuring-account-type-names).

This behavior pertains to the invoice, journal entry, refund receipt, and sales receipt tax line entries. (Purchase tax lines will be associated with their purchase accounts).
47 changes: 29 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## Table of Contents
- [What does this dbt package do?](https://github.com/fivetran/dbt_quickbooks/#-what-does-this-dbt-package-do)
- [How do I use the dbt package?](https://github.com/fivetran/dbt_quickbooks_source/#-how-do-i-use-the-dbt-package)
- [How do I use the dbt package?](https://github.com/fivetran/dbt_quickbooks/#-how-do-i-use-the-dbt-package)
- [Required steps](https://github.com/fivetran/dbt_quickbooks/#step-1-prerequisites)
- [Additional options](https://github.com/fivetran/dbt_quickbooks/#optional-step-5-additional-configurations)
- [Does this package have dependencies?](https://github.com/fivetran/dbt_quickbooks/#-does-this-package-have-dependencies)
Expand All @@ -27,7 +27,7 @@
- [Are there any resources available?](https://github.com/fivetran/dbt_quickbooks/#-are-there-any-resources-available)

## What does this dbt package do?
- Produces modeled tables that leverage QuickBooks data from [Fivetran's connector](https://fivetran.com/docs/applications/quickbooks) in the format described by [this ERD](https://fivetran.com/docs/applications/quickbooks#schemainformation) and builds off the output of our [QuickBooks source package](https://github.com/fivetran/dbt_quickbooks_source).
- Produces modeled tables that leverage QuickBooks data from [Fivetran's connector](https://fivetran.com/docs/applications/quickbooks) in the format described by [this ERD](https://fivetran.com/docs/applications/quickbooks#schemainformation).

- Enables users with insights into their QuickBooks data that can be used for financial statement reporting and deeper analysis. The package achieves this by:
- Creating a comprehensive general ledger that can be used to create financial statements with additional flexibility.
Expand All @@ -53,12 +53,12 @@ The following table provides a detailed list of all tables materialized within t
| [quickbooks__expenses_sales_enhanced](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__expenses_sales_enhanced) | Table providing enhanced customer, vendor, and account details for each expense and sale transaction. |

### Materialized Models
Each Quickstart transformation job run materializes 94 models if all components of this data model are enabled. This count includes all staging, intermediate, and final models materialized as `view`, `table`, or `incremental`.
Each Quickstart transformation job run materializes 108 models if all components of this data model are enabled. This count includes all staging, intermediate, and final models materialized as `view`, `table`, or `incremental`.
<!--section-end-->

### Multicurrency Support

> [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) now supports multicurrency by bringing in values by specifying `*_converted_*` values for cash amounts. More details are [available in the DECISIONLOG](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#multicurrency-vs-single-currency-configuration).
> [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) now supports multicurrency by bringing in values by specifying `*_converted_*` values for cash amounts. More details are [available in the DECISIONLOG](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#multicurrency-vs-single-currency-configuration).

## How do I use the dbt package?
### Step 1: Prerequisites
Expand All @@ -74,10 +74,10 @@ Include the following QuickBooks package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/quickbooks
version: [">=0.21.0", "<0.22.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=1.0.0", "<1.1.0"] # we recommend using ranges to capture non-breaking changes automatically
```

Do NOT include the `quickbooks_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.
> All required sources and staging models are now bundled into this transformation package. Do not include `fivetran/quickbooks_source` in your `packages.yml` since this package has been deprecated.

### Step 3: Define database and schema variables
By default, this package runs using your destination and the `quickbooks` schema of your [target database](https://docs.getdbt.com/docs/running-a-dbt-project/using-the-command-line-interface/configure-your-profile). If this is not where your QuickBooks data is (for example, if your QuickBooks schema is named `quickbooks_fivetran`), add the following configuration to your root `dbt_project.yml` file:
Expand Down Expand Up @@ -110,7 +110,14 @@ vars:
using_vendor_credit: false # disable if you don't have vendor credits in QuickBooks
using_sales_receipt: false # disable if you don't have sales receipts in QuickBooks
using_credit_card_payment_txn: true # enable if you want to include credit card payment transactions in your staging models
using_purchase_order: true #enable if you want to include purchase orders in your staging models
using_purchase_order: true #enable if you want to include purchase orders in your staging
using_invoice_tax_line: true #enable if you have invoice tax lines in QuickBooks
using_journal_entry_tax_line: true # enable if you have journal entry tax lines in QuickBooks
using_purchase_tax_line: true # enable if you have purchase tax lines in QuickBooks
using_refund_receipt_tax_line: true # enable if you have refund receipt tax lines in QuickBooks
using_sales_receipt_tax_line: true # enable if you have sales receipt tax lines in QuickBooks
using_tax_agency: true #enable if you have tax agencies in QuickBooks
using_tax_rate: true #enable if you have tax rates in QuickBooks
```

### (Optional) Step 5: Additional Configurations
Expand Down Expand Up @@ -138,8 +145,16 @@ If you have a different value to reference for each type, you will need to confi
vars:
quickbooks__accounts_payable_reference: accounts_payable_value # 'Accounts Payable' is the default filter set for the account_type reference.
quickbooks__accounts_receivable_reference: account_receivable_value # 'Accounts Receivable' is the default filter set for the account_type reference.
quickbooks__undeposited_funds_reference: account_undeposited_funds_value # 'UndepositedFunds' is the default filter set for the account_subtype reference.
quickbooks__sales_of_product_income_reference: account_sales_of_product_income_value # 'SalesOfProductIncome' is the default filter set for the account_subtype reference.
quickbooks__undeposited_funds_reference: account_undeposited_funds_value # 'UndepositedFunds' is the default filter set for the account_sub_type reference.
quickbooks__sales_of_product_income_reference: account_sales_of_product_income_value # 'SalesOfProductIncome' is the default filter set for the account_sub_type reference.
```

We conduct similar mappings to Global Tax and Sales Tax Account values, except they are applied to the account `name` field. If you have a different value to reference for each type, you will need to configure the `name` variables in your `dbt_project.yml`. **IMPORTANT**: Please make sure the account name is unique for your reference. [See the DECISIONLOG for more details](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#bringing-in-the-right-tax-accounts-for-tax-lines).

```yml
vars:
quickbooks__global_tax_account_reference: global_tax_account_value # 'Global Tax Payable' is the default filter set for the account name reference.
quickbooks__sales_tax_account_reference: sales_tax_account_value # 'Sales Tax Payable' is the default filter set for the account name reference.
```

#### Customize the Cash Flow Model
Expand Down Expand Up @@ -198,15 +213,14 @@ By default this package will build the QuickBooks staging models within a schema
...
models:
quickbooks:
+schema: my_new_schema_name # leave blank for just the target_schema

quickbooks_source:
+schema: my_new_schema_name # leave blank for just the target_schema
+schema: my_new_schema_name # Leave +schema: blank to use the default target_schema.
staging:
+schema: my_new_schema_name # Leave +schema: blank to use the default target_schema.
```

#### Change the source table references
If an individual source table has a different name than the package expects, add the table name as it appears in your destination to the respective variable:
> IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_quickbooks_source/blob/main/dbt_project.yml) variable declarations to see the expected names.
> IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_quickbooks/blob/main/dbt_project.yml) variable declarations to see the expected names.

```yml
vars:
Expand All @@ -226,9 +240,6 @@ This dbt package is dependent on the following dbt packages. These dependencies

```yml
packages:
- package: fivetran/quickbooks_source
version: [">=0.14.0", "<0.15.0"]

- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]

Expand All @@ -238,7 +249,7 @@ packages:

## How is this package maintained and can I contribute?
### Package Maintenance
The Fivetran team maintaining this package _only_ maintains the latest version of the package. We highly recommend that you stay consistent with the [latest version](https://hub.getdbt.com/fivetran/quickbooks_source/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_quickbooks/blob/main/CHANGELOG.md) and release notes for more information on changes across versions.
The Fivetran team maintaining this package _only_ maintains the latest version of the package. We highly recommend that you stay consistent with the [latest version](https://hub.getdbt.com/fivetran/quickbooks/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_quickbooks/blob/main/CHANGELOG.md) and release notes for more information on changes across versions.

### Contributions
A small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions.
Expand Down
Loading