Quickbooks model

General ledger

Every debit and credit QuickBooks Online posted, one row per journal line, with the account's classification attached. This is the base for the trial balance and the P&L, and the table to filter when someone asks "what hit this account".

Grain
company x transaction id x document number x line position
Built from
  1. 3
    Raw tables
  2. 3
    Staging
  3. 1
    Core
  4. 1
    Analytics
Reads from Quickbooks
accountjournal_reportjournal_report_line
Ships as
Weld and dbt SQL, open source on GitHub
core.quickbooks.general_ledger
1-- core.quickbooks.general_ledger
2-- Every debit and credit QuickBooks Online posted, one row per journal line, with
3-- the account's classification attached. This is the base for the trial balance
4-- and the P&L, and the table to filter when someone asks "what hit this account".
5--
6-- Grain: company x transaction id x document number x line position. Line position
7-- 0 is the transaction's first line; later lines keep the order of the report.
8--
9-- Source: QuickBooks' Journal report, which covers every transaction type that
10-- posts to the ledger (invoices, sales receipts, payments, bills, bill payments,
11-- checks, expenses, deposits, transfers, journal entries). Reading it avoids
12-- rebuilding the ledger from a dozen transaction streams, each with its own line
13-- layout and its own idea of which account is hit.
14--
15-- Currency: the company's home currency. Foreign-currency transactions are already
16-- converted by QuickBooks at the transaction's exchange rate.
17--
18-- Signs:
19--   debit, credit     both positive, exactly as QuickBooks shows them
20--   net_debit         debit - credit. Sums to zero over any complete transaction,
21--                     and over the whole ledger.
22--   amount_natural    signed by the account's normal balance: debit - credit for
23--                     Asset and Expense accounts, credit - debit for Liability,
24--                     Equity and Revenue. Positive means the account grew.
25
26WITH lines AS (
27    SELECT
28        quickbooks_company,
29        transaction_id,
30        transaction_number,
31        0           AS line_position,
32        memo,
33        account_id,
34        account_name,
35        debit,
36        credit
37    FROM {{staging.quickbooks.journal_report}}
38
39    UNION ALL
40

This model and the 4 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().

Notes

How it counts. And where it stops.

Source: QuickBooks' Journal report, which covers every transaction type that posts to the ledger (invoices, sales receipts, payments, bills, bill payments, checks, expenses, deposits, transfers, journal entries). Reading it avoids rebuilding the ledger from a dozen transaction streams, each with its own line layout and its own idea of which account is hit. Currency: the company's home currency. Foreign-currency transactions are already converted by QuickBooks at the transaction's exchange rate. Signs: debit, credit both positive, exactly as QuickBooks shows them net_debit debit - credit. Sums to zero over any complete transaction, and over the whole ledger. amount_natural signed by the account's normal balance: debit - credit for Asset and Expense accounts, credit - debit for Liability, Equity and Revenue. Positive means the account grew.

Raw tables it reads

  • raw.quickbooks.account
  • raw.quickbooks.journal_report
  • raw.quickbooks.journal_report_line

Put Quickbooks in front
of your agents.

Connect Quickbooks, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.