Skip to content
Open
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package-lock.yml
.dbt/
dbt_modules/
dbt_packages/
dbt_internal_packages/
**/dbt_internal_packages/
logs/
profiles.yml
target/
Expand Down
3 changes: 2 additions & 1 deletion .quickstart/quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public_models: [
"quickbooks__profit_and_loss",
"quickbooks__expenses_sales_enhanced",
"quickbooks__ap_ar_enhanced",
"quickbooks__cash_flow_statement"
"quickbooks__cash_flow_statement",
"quickbooks__inventory_item_activity"
]

supported_vars:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# dbt_quickbooks v1.8.0
[PR #208](https://github.com/fivetran/dbt_quickbooks/pull/208) includes the following updates:

## Schema/Data Change
**3 total changes • 0 possible breaking changes**

| Data Model(s) | Change type | Old | New | Notes |
| ------------- | ----------- | --- | --- | ----- |
| `quickbooks__inventory_item_activity` | New model | — | — | New line-level view of all item-bearing transactions, including item enrichment details, inventory quantity, unit price, and status indicators for inventory movement analysis. |
| `stg_quickbooks__item` | New fields | — | `description`, `stock_keeping_unit`, `quantity_on_hand`, `track_quantity_on_hand`, `fully_qualified_name` | Fields were present in the source but not previously exposed in the model. |
| `stg_quickbooks__purchase_order_line`<br>`stg_quickbooks__bill_line`<br>`stg_quickbooks__purchase_line` | New fields | — | `item_expense_quantity`, `item_expense_unit_price` | Fields were present in the source but not previously exposed in the model. |

# dbt_quickbooks v1.6.3
[PR #211](https://github.com/fivetran/dbt_quickbooks/pull/211) includes the following updates:

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This dbt package transforms data from Fivetran's Quickbooks connector into analy

## Resources

- Number of materialized models¹: 108
- Number of materialized models¹: 109
- Connector documentation
- [Quickbooks connector documentation](https://fivetran.com/docs/connectors/applications/quickbooks)
- [Quickbooks ERD](https://fivetran.com/docs/connectors/applications/quickbooks#schemainformation)
Expand Down Expand Up @@ -40,6 +40,7 @@ By default, this package materializes the following final tables:
| [quickbooks__cash_flow_statement](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__cash_flow_statement) | Cash flow statement showing operating, investing, and financing activities with beginning/ending cash positions and net changes by period. **IMPORTANT**: You will likely need to configure cash flow types for your specific use case. <br><br>**Example Analytics Questions:**<br><ul><li>Which operational improvements are generating the strongest positive cash flow trends?</li><li>What seasonal cash flow patterns and financing needs can inform strategic planning?</li></ul> |
| [quickbooks__ap_ar_enhanced](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__ap_ar_enhanced) | Accounts payable and receivable aging report showing outstanding bills and invoices with payment history, due dates, and overdue analysis for cash flow management. <br><br>**Example Analytics Questions:**<br><ul><li>Which customers have the best payment patterns and deserve credit limit increases or early payment discounts?</li><li>What payment timing patterns and customer behavior trends can optimize cash flow forecasting?</li></ul> |
| [quickbooks__expenses_sales_enhanced](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__expenses_sales_enhanced) | Unified view of all expense and sales transactions with enriched customer, vendor, department, and product details for comprehensive revenue and cost analysis. <br><br>**Example Analytics Questions:**<br><ul><li>Which customer segments and product lines deliver the highest margins and growth potential?</li><li>What departmental spending patterns and vendor relationships provide the best cost optimization opportunities?</li></ul> |
| [quickbooks__inventory_item_activity](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.quickbooks__inventory_item_activity) | Line-level view of all item-bearing transactions across purchases, bills, vendor credits, invoices, sales receipts, credit memos, refund receipts, and purchase orders. Each row includes item enrichment details, inventory quantity, unit price, and status indicators for inventory movement analysis. <br><br>**Example Analytics Questions:**<br><ul><li>Which items move the most volume across transaction types, and how does that vary by period?</li><li>What is the net item movement by SKU across inbound and outbound transactions?</li></ul> |

¹ Each Quickstart transformation job run materializes these 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`.

Expand Down Expand Up @@ -70,7 +71,7 @@ Include the following QuickBooks package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/quickbooks
version: [">=1.6.0", "<1.7.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=1.7.0", "<1.8.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/quickbooks_source` in your `packages.yml` since this package has been deprecated.
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2
name: 'quickbooks'

version: '1.6.3'
version: '1.8.0'

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.

6 changes: 5 additions & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: 'quickbooks_integration_tests'

version: '1.6.3'
version: '1.8.0'

profile: 'integration_tests'
config-version: 2
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/seeds/bill_line_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ bill_id,index,_fivetran_synced,account_expense_account_id,account_expense_billab
404,0,2020-12-17 20:17:06,12,8f7d086bb399bd5291915511d499a09d,,,,7624ad70a400ab16bed0602ac396f02b,825,b9823c862eb0e351b6b30c74148dc4e4,,,,,,,
19,0,2020-05-20 14:03:29,13,8f7d086bb399bd5291915511d499a09d,,,,7624ad70a400ab16bed0602ac396f02b,5761,137e67d47e89e7e4ebe6344d215bad8a,,,,,,,
5000,0,2024-01-01 12:00:00,873,,,,,,100,69c19a9b03e7f423a52d9a298fb12b34,,,,,,,
5001,0,2024-01-01 12:00:00,,,,,,,150,c0923c862eb0e351b6b30c74148dc4e4,,,,8748,1,,150
5001,0,2024-01-01 12:00:00,,,,,,,150,c0923c862eb0e351b6b30c74148dc4e4,,,,8748,1,,150
399,1,2020-12-17 19:32:00,,,,,,,7282,4e607e75b05d403ca078f850ccab9518,,,,8748,1,,7282
401,1,2020-12-17 19:32:00,,,,,,,1386,57c19a9b03e7f423a52d9a298fb12b34,,,,8748,1,,1386
5000,1,2024-01-01 12:00:00,,,,,,,100,69c19a9b03e7f423a52d9a298fb12b34,,,,8748,1,,100
3 changes: 2 additions & 1 deletion integration_tests/seeds/invoice_line_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ index,invoice_id,_fivetran_synced,amount,bundle_id,bundle_quantity,description,d
1,40115,2025-06-30 12:00:00,1005.00,212,1.0,,,,,,,,,,999,100,,9999,1.0,,NON,1005,,,,,999,SalesItemLineDetail
0,40116,2025-06-30 12:00:00,500.00,212,1.0,,,,,,,,,,999,100,,9999,1.0,,NON,1005,,,,,999,SubTotalLineDetail
1,40116,2025-06-30 12:00:00,500.00,212,1.0,,,,,,,,,,999,100,,9999,1.0,,NON,1005,,,,,999,SalesItemLineDetail
1,50001,2026-02-01 12:00:00,1000.00,,,,,,,,,,,,999,,,,,,,1000,,,,,999,SalesItemLineDetail
1,50001,2026-02-01 12:00:00,1000.00,,,,,,,,,,,,999,,,,,,,1000,,,,,999,SalesItemLineDetail
2,50001,2026-02-01 12:00:00,1000.00,,,,,,,,,,,,,,,9999,1,,,1000,,,,,,SalesItemLineDetail
5 changes: 4 additions & 1 deletion integration_tests/seeds/item_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ id,_fivetran_synced,active,asset_account_id,created_at,description,expense_accou
9999,2021-01-05 12:00:05,TRUE,,2021-01-05 12:00:05,,,1c23515c3bdf65b7d7658ddf8e97e55,999,,,1c24051547edf65b7d7658ddf8e97e39,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,200,2021-01-05 12:00:01,FALSE
888,2024-01-01 12:00:01,TRUE,,2024-01-01 12:00:01,,,5a23515d3bdf64b6d7658ddf8e97e64,888,,,5a23515d3bdf64b6d7658ddf8e97e65,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,,2024-01-01 12:01:01,FALSE
8743,2024-01-01 12:00:01,TRUE,,2024-01-01 12:00:01,,,5a23515d3bdf64b6d7658ddf8e97e64,888,,,5a23515d3bdf64b6d7658ddf8e97e65,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,,2024-01-01 12:01:01,FALSE
58881,2024-01-11 12:00:01,TRUE,,2024-01-11 12:00:01,,,6a21115d3bdf32b6d7658ddf8e44e75,48881,,,1c24051547edf65b7d7658ddf8e97e40,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,150,2024-01-15 12:01:01,FALSE
58881,2024-01-11 12:00:01,TRUE,,2024-01-11 12:00:01,,,6a21115d3bdf32b6d7658ddf8e44e75,48881,,,1c24051547edf65b7d7658ddf8e97e40,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,150,2024-01-15 12:01:01,FALSE
100,2021-01-19 12:00:00,TRUE,,2021-01-19 12:00:00,,,7b34052d3bdf65b7d7658ddf8e97f00,999,,,7b34052d3bdf65b7d7658ddf8e97f00,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,1250,2021-01-19 12:00:00,FALSE
8748,2024-01-01 12:00:00,TRUE,,2024-01-01 12:00:00,,,5b23515d3bdf64b6d7658ddf8e97f48,888,,,5b23515d3bdf64b6d7658ddf8e97f48,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,150,2024-01-01 12:00:00,FALSE
91588,2024-01-23 12:00:00,TRUE,,2024-01-23 12:00:00,,,6c34626e3bdf75c7e8769eef9f08f88,888,,,6c34626e3bdf75c7e8769eef9f08f88,,0,,,,,,,,,0,FALSE,FALSE,92581ed3a1ac6dec57db359c3de94bb0,150,2024-01-23 12:00:00,FALSE
9 changes: 8 additions & 1 deletion integration_tests/seeds/purchase_line_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ index,purchase_id,_fivetran_synced,account_expense_account_id,account_expense_bi
0,342,2020-12-05 2:47:01,3,15937541ca23d45a66ca60ea1657c699,,,,7624ad70a400ab16bed0602ac396f02b,62,b1b73c20e3b5ad9eb21aad036a3baf45,,,,,,,
0,350,2020-12-05 2:47:01,3,15937541ca23d45a66ca60ea1657c699,,,,7624ad70a400ab16bed0602ac396f02b,21,b1b73c20e3b5ad9eb21aad036a3baf45,,,,,,,
0,87001,2024-01-15 10:00:00,48881,15937541ca23d45a66ca60ea1657c699,,,,7624ad70a400ab16bed0602ac396f02b,100,b1b73c20e3b5ad9eb21aad036a3baf45,,,,,,,
0,87002,2024-01-15 10:00:00,,15937541ca23d45a66ca60ea1657c699,,,,7624ad70a400ab16bed0602ac396f02b,150,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,150
0,87002,2024-01-15 10:00:00,,15937541ca23d45a66ca60ea1657c699,,,,7624ad70a400ab16bed0602ac396f02b,150,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,150
1,190,2020-11-06 1:32:07,,,,,,,39,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,39
1,228,2020-11-06 1:32:07,,,,,,,44,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,44
1,340,2020-12-05 2:47:01,,,,,,,56,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,56
1,342,2020-12-05 2:47:01,,,,,,,62,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,62
1,350,2020-12-05 2:47:01,,,,,,,21,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,21
1,372,2020-12-05 3:02:15,,,,,,,36,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,36
1,87001,2024-01-15 10:00:00,,,,,,,100,b1b73c20e3b5ad9eb21aad036a3baf45,,,,58881,1,,100
3 changes: 2 additions & 1 deletion integration_tests/seeds/refund_receipt_line_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ index,refund_id,_fivetran_synced,amount,bundle_id,bundle_quantity,description,de
1,105,2020-10-15 14:17:07,85,,,,,,,,,,,,,,,,,,,,
1,104,2020-10-15 14:17:07,71,,,,,,,,,,,,,,,,,,,,
0,298,2021-01-10 11:00:00,100,,,a78065ddefad0fa26475074a4bdbb616,,,,,,,,,,,,9999,1,,7624ad70a400ab16bed0602ac396f02b,,
0,3001,2021-01-11 12:00:00,125,,,a78065ddefad0fa26475074a4bdbb616,,,,,,,,1999,,,,,1,,7624ad70a400ab16bed0602ac396f02c,,
0,3001,2021-01-11 12:00:00,125,,,a78065ddefad0fa26475074a4bdbb616,,,,,,,,1999,,,,,1,,7624ad70a400ab16bed0602ac396f02c,,
1,3001,2021-01-11 12:00:00,125,,,a78065ddefad0fa26475074a4bdbb616,,,,,,,,,,,,9999,1,,7624ad70a400ab16bed0602ac396f02c,,
5 changes: 4 additions & 1 deletion integration_tests/seeds/vendor_credit_line_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ index,vendor_credit_id,_fivetran_synced,account_expense_account_id,account_expen
0,61,2020-07-13 19:16:59,49,15937541ca23d45a66ca60ea1657c699,,,,NON,800,24a27691bc26242c25060e9f49547618,,,,,,,,
0,62,2020-07-13 19:16:59,49,15937541ca23d45a66ca60ea1657c699,,,,NON,25,6dc545e7031f842e4f0bbf1b9f2e700c,,,,,,,,
0,94501,2024-01-23 09:00:00,91515,Yes,,,5,NON,100,3ac565e7031f852e4aa1f1b9f2e700c,,,,,,,,
0,94502,2024-01-23 09:00:00,,,,,10,NON,150,6565e6238f852e4aa1f1b9f13a00c,,,,91588,1,,150,
0,94502,2024-01-23 09:00:00,,,,,10,NON,150,6565e6238f852e4aa1f1b9f13a00c,,,,91588,1,,150,
1,61,2020-07-13 19:16:59,,,,,,,800,24a27691bc26242c25060e9f49547618,,,,91588,1,,800,
1,62,2020-07-13 19:16:59,,,,,,,25,6dc545e7031f842e4f0bbf1b9f2e700c,,,,91588,1,,25,
1,94501,2024-01-23 09:00:00,,,,,,,100,3ac565e7031f852e4aa1f1b9f2e700c,,,,91588,1,,100,
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

-- this test ensures the inventory item activity end model matches the prior version
with prod as (
select {{ dbt_utils.star(from=ref('quickbooks__inventory_item_activity'), except=var('qb_consistency_exclude_columns', [])) }}
from {{ target.schema }}_quickbooks_prod.quickbooks__inventory_item_activity
),

dev as (
select {{ dbt_utils.star(from=ref('quickbooks__inventory_item_activity'), except=var('qb_consistency_exclude_columns', [])) }}
from {{ target.schema }}_quickbooks_dev.quickbooks__inventory_item_activity
),

prod_not_in_dev as (
-- rows from prod not found in dev
select * from prod
except distinct
select * from dev
),

dev_not_in_prod as (
-- rows from dev not found in prod
select * from dev
except distinct
select * from prod
),

final as (
select
*,
'from prod' as source
from prod_not_in_dev

union all -- union since we only care if rows are produced

select
*,
'from dev' as source
from dev_not_in_prod
)

select *
from final
101 changes: 93 additions & 8 deletions models/intermediate/int_quickbooks__expenses_union.sql
Original file line number Diff line number Diff line change
@@ -1,33 +1,118 @@
with expense_union as (

select *
select
transaction_id,
source_relation,
transaction_line_id,
doc_number,
transaction_type,
transaction_date,
account_id,
class_id,
department_id,
customer_id,
vendor_id,
billable_status,
description,
amount,
converted_amount,
total_amount,
total_converted_amount
from {{ ref('int_quickbooks__purchase_transactions') }}

{% if var('using_bill', True) %}
union all

select *
select
transaction_id,
source_relation,
transaction_line_id,
doc_number,
transaction_type,
transaction_date,
account_id,
class_id,
department_id,
customer_id,
vendor_id,
billable_status,
description,
amount,
converted_amount,
total_amount,
total_converted_amount
from {{ ref('int_quickbooks__bill_transactions') }}
{% endif %}
{% endif %}

{% if var('using_journal_entry', True) %}
union all

select *
select
transaction_id,
source_relation,
transaction_line_id,
doc_number,
transaction_type,
transaction_date,
account_id,
class_id,
department_id,
customer_id,
vendor_id,
billable_status,
description,
amount,
converted_amount,
total_amount,
total_converted_amount
from {{ ref('int_quickbooks__journal_entry_transactions')}}
{% endif %}
{% endif %}

{% if var('using_deposit', True) %}
union all

select *
select
transaction_id,
source_relation,
transaction_line_id,
doc_number,
transaction_type,
transaction_date,
account_id,
class_id,
department_id,
customer_id,
vendor_id,
billable_status,
description,
amount,
converted_amount,
total_amount,
total_converted_amount
from {{ ref('int_quickbooks__deposit_transactions')}}
{% endif %}
{% endif %}

{% if var('using_vendor_credit', True) %}
union all

select *
select
transaction_id,
source_relation,
transaction_line_id,
doc_number,
transaction_type,
transaction_date,
account_id,
class_id,
department_id,
customer_id,
vendor_id,
billable_status,
description,
amount,
converted_amount,
total_amount,
total_converted_amount
from {{ ref('int_quickbooks__vendor_credit_transactions') }}
{% endif %}
),
Expand Down
51 changes: 50 additions & 1 deletion models/quickbooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,53 @@ models:
- name: converted_amount
description: The total ending period balance, converted with exchange rates applied if available,
- name: account_ordinal
description: "{{ doc('account_ordinal') }}"
description: "{{ doc('account_ordinal') }}"

- name: quickbooks__inventory_item_activity
description: >
Line-level view of all item-bearing transactions across purchases, bills, vendor credits, invoices, sales receipts,
credit memos, refund receipts, and purchase orders. Each row includes item enrichment details, inventory quantity,
unit price, and status indicators for inventory movement analysis.
columns:
- name: inventory_item_activity_id
description: Surrogate primary key hashed on transaction_type, transaction_id, transaction_line_id, and source_relation.
tests:
- unique
- not_null
- name: transaction_type
description: The source transaction type (invoice, bill, purchase, sales_receipt, credit_memo, refund_receipt, vendor_credit, purchase_order).
- name: transaction_id
description: Unique identifier of the parent transaction.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Unique identifier of the parent transaction.
description: "{{ doc('transaction_id') }}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches other transaction_id fields in yml

- name: transaction_line_id
description: Index of the line within the parent transaction. Combined with transaction_id and source_relation, uniquely identifies the row.
- name: doc_number
description: Reference number for the transaction, as shown in QuickBooks reports.
- name: transaction_date
description: Date the transaction occurred.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Date the transaction occurred.
description: "{{ doc('transaction_date') }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches other transaction_date fields in yml

- name: item_id
description: Foreign key to the item record. Null for non-item lines.
- name: name
description: Item name from the item table.
- name: type
description: Item type (Inventory, NonInventory, Service, etc.). Use to filter to physical inventory items.
- name: description
description: Item sale or purchase description from the item record.
- name: stock_keeping_unit
description: Stock keeping unit (SKU) for the item.
- name: quantity
description: Raw line-level quantity from the source. Always a positive value; use inventory_direction to determine movement direction.
- name: inventory_direction
description: >
Indicates the direction of inventory movement: inbound (items received — bills, purchases,
credit memos, refund receipts), outbound (items leaving — invoices, sales receipts,
vendor credits), or pending (items ordered but not yet received — purchase orders).
- name: unit_price
description: Unit price from the transaction line, reflecting the actual price recorded on the transaction.
- name: amount
description: Total line amount. For credit memos, refund receipts, and vendor credits, this value is negative as recorded in the source transaction.
- name: customer_id
description: Customer associated with the transaction. Populated for sales-side transactions; null for purchase-side transactions.
- name: vendor_id
description: Vendor associated with the transaction. Populated for purchase-side transactions; null for sales-side transactions.
- name: source_relation
description: "{{ doc('source_relation') }}"
Loading