Skip to content

Commit

Permalink
Merge pull request #146 from fivetran/feature/add-created-at-and-upda…
Browse files Browse the repository at this point in the history
…ted-at

Add `created_at` and `updated_at` fields
  • Loading branch information
fivetran-avinash authored Nov 26, 2024
2 parents c0ca2ea + 2e600db commit c57a9c2
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 40 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# dbt_quickbooks v0.17.0-a1

## Bug Fix
- Updated the logic in `int_quickbooks__retained_earnings` to ensure accounting periods with no revenue and expense class lines were accounted for.
- This will ensure the net income adjustment is available regardless of existing revenue or expenses.
# dbt_quickbooks v0.17.0
[PR #146](https://github.com/fivetran/dbt_quickbooks/pull/146) introduces the following updates:

## Breaking Changes
- Introduced the following fields in the `quickbooks__general_ledger` model to better analyze real-time transaction data::
- `created_at`: The time a transaction was first created.
- `updated_at`: The time a transaction was last updated.
- Updated the `*_double_entry` models to add these fields for each transaction type.
- This is a breaking change as this adds new fields to the existing schema.

# dbt_quickbooks v0.16.0
[PR #143](https://github.com/fivetran/dbt_quickbooks/pull/143) introduces the following updates:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Include the following QuickBooks package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/quickbooks
version: 0.17.0-a1 # we recommend using ranges to capture non-breaking changes automatically
version: [">=0.17.0", "<0.18.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.
Expand Down Expand Up @@ -226,7 +226,7 @@ This dbt package is dependent on the following dbt packages. These dependencies
```yml
packages:
- package: fivetran/quickbooks_source
version: [">=0.11.0", "<0.12.0"]
version: [">=0.12.0", "<0.13.0"]
- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
Expand Down
6 changes: 5 additions & 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.

12 changes: 0 additions & 12 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ profile: 'integration_tests'
config-version: 2
models:
+schema: "quickbooks_{{ var('directed_schema','dev') }}"
quickbooks:
+materialized: table
double_entry_transactions:
+materialized: table
transaction_lines:
+materialized: table
intermediate:
+materialized: table
quickbooks_source:
+materialized: table
tmp:
+materialized: view

vars:
quickbooks_source:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ bill_join as (
coalesce(bill_lines.account_expense_customer_id, bill_lines.item_expense_customer_id) as customer_id,
coalesce(bill_lines.item_expense_class_id, bill_lines.account_expense_class_id) as class_id,
bills.vendor_id,
bills.department_id
bills.department_id,
bills.created_at,
bills.updated_at
from bills

inner join bill_lines
Expand All @@ -68,6 +70,8 @@ final as (
payed_to_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'bill' as transaction_source
from bill_join
Expand All @@ -86,6 +90,8 @@ final as (
payable_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'bill' as transaction_source
from bill_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ bill_payment_join as (
coalesce(bill_payments.credit_card_account_id,bill_payments.check_bank_account_id) as payment_account_id,
ap_accounts.account_id,
bill_payments.vendor_id,
bill_payments.department_id
bill_payments.department_id,
bill_payments.created_at,
bill_payments.updated_at
from bill_payments

left join ap_accounts
Expand All @@ -71,6 +73,8 @@ final as (
payment_account_id as account_id,
cast(null as {{ dbt.type_string() }}) as class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'bill payment' as transaction_source
from bill_payment_join
Expand All @@ -89,6 +93,8 @@ final as (
account_id,
cast(null as {{ dbt.type_string() }}) as class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'bill payment' as transaction_source
from bill_payment_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ credit_card_payment_prep as (
cast(null as {{ dbt.type_string() }}) as customer_id,
cast(null as {{ dbt.type_string() }}) as vendor_id,
cast(null as {{ dbt.type_string() }}) as class_id,
cast(null as {{ dbt.type_string() }}) as department_id
cast(null as {{ dbt.type_string() }}) as department_id,
created_at,
updated_at
from credit_card_payments
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ credit_memo_join as (
credit_memos.customer_id,
coalesce(credit_memo_lines.sales_item_class_id, credit_memo_lines.discount_class_id, credit_memos.class_id) as class_id,
credit_memos.department_id,
credit_memos.currency_id
credit_memos.currency_id,
credit_memos.created_at,
credit_memos.updated_at

from credit_memos

Expand Down Expand Up @@ -84,6 +86,8 @@ final as (
account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'credit_memo' as transaction_source
from credit_memo_join
Expand All @@ -102,6 +106,8 @@ final as (
df_accounts.account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'credit_memo' as transaction_source
from credit_memo_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ deposit_join as (
coalesce(deposit_lines.deposit_account_id, uf_accounts.account_id) as deposit_from_acct_id,
deposit_customer_id as customer_id,
deposit_lines.deposit_class_id as class_id,
deposits.department_id
deposits.department_id,
deposits.created_at,
deposits.updated_at

from deposits

Expand All @@ -76,6 +78,8 @@ final as (
deposit_to_acct_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'deposit' as transaction_source
from deposit_join
Expand All @@ -94,6 +98,8 @@ final as (
deposit_from_acct_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'deposit' as transaction_source
from deposit_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ invoice_join as (
coalesce(invoice_lines.sales_item_class_id, invoice_lines.discount_class_id, invoices.class_id) as class_id,

invoices.customer_id,
invoices.department_id
invoices.department_id,
invoices.created_at,
invoices.updated_at

from invoices

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ final as (
journal_entry_lines.account_id,
class_id,
journal_entry_lines.department_id,
journal_entries.created_at,
journal_entries.updated_at,
lower(journal_entry_lines.posting_type) as transaction_type,
'journal_entry' as transaction_source
from journal_entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ payment_join as (
payments.deposit_to_account_id,
payments.receivable_account_id,
payments.customer_id,
payments.currency_id
payments.currency_id,
payments.created_at,
payments.updated_at
from payments
),

Expand All @@ -67,6 +69,8 @@ final as (
deposit_to_account_id as account_id,
cast(null as {{ dbt.type_string() }}) as class_id,
cast(null as {{ dbt.type_string() }}) as department_id,
created_at,
updated_at,
'debit' as transaction_type,
'payment' as transaction_source
from payment_join
Expand All @@ -85,6 +89,8 @@ final as (
coalesce(receivable_account_id, ar_accounts.account_id) as account_id,
cast(null as {{ dbt.type_string() }}) as class_id,
cast(null as {{ dbt.type_string() }}) as department_id,
created_at,
updated_at,
'credit' as transaction_type,
'payment' as transaction_source
from payment_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ purchase_join as (
purchases.customer_id,
coalesce(purchase_lines.item_expense_class_id, purchase_lines.account_expense_class_id) as class_id,
purchases.vendor_id,
purchases.department_id
purchases.department_id,
purchases.created_at,
purchases.updated_at
from purchases

inner join purchase_lines
Expand All @@ -67,6 +69,8 @@ final as (
payed_from_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
payed_from_transaction_type as transaction_type,
'purchase' as transaction_source
from purchase_join
Expand All @@ -85,6 +89,8 @@ final as (
payed_to_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
payed_to_transaction_type as transaction_type,
'purchase' as transaction_source
from purchase_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ refund_receipt_join as (
coalesce(refund_receipt_lines.discount_account_id, refund_receipt_lines.sales_item_account_id, items.parent_income_account_id, items.income_account_id) as debit_account_id,
refund_receipts.customer_id,
coalesce(refund_receipt_lines.sales_item_class_id, refund_receipt_lines.discount_class_id, refund_receipts.class_id) as class_id,
refund_receipts.department_id
refund_receipts.department_id,
refund_receipts.created_at,
refund_receipts.updated_at
from refund_receipts

inner join refund_receipt_lines
Expand Down Expand Up @@ -70,6 +72,8 @@ final as (
credit_to_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'refund_receipt' as transaction_source
from refund_receipt_join
Expand All @@ -88,6 +92,8 @@ final as (
debit_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'refund_receipt' as transaction_source
from refund_receipt_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ sales_receipt_join as (
coalesce(sales_receipt_lines.discount_account_id, sales_receipt_lines.sales_item_account_id, items.parent_income_account_id, items.income_account_id) as credit_to_account_id,
sales_receipts.customer_id,
coalesce(sales_receipt_lines.sales_item_class_id, sales_receipt_lines.discount_class_id, sales_receipts.class_id) as class_id,
sales_receipts.department_id
sales_receipts.department_id,
sales_receipts.created_at,
sales_receipts.updated_at
from sales_receipts

inner join sales_receipt_lines
Expand Down Expand Up @@ -78,6 +80,8 @@ final as (
debit_to_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'sales_receipt' as transaction_source
from sales_receipt_join
Expand All @@ -96,6 +100,8 @@ final as (
credit_to_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'sales_receipt' as transaction_source
from sales_receipt_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ transfer_body as (
amount,
amount as converted_amount,
from_account_id as credit_to_account_id,
to_account_id as debit_to_account_id
to_account_id as debit_to_account_id,
created_at,
updated_at
from transfers
),

Expand All @@ -40,6 +42,8 @@ final as (
credit_to_account_id as account_id,
cast(null as {{ dbt.type_string() }}) as class_id,
cast(null as {{ dbt.type_string() }}) as department_id,
created_at,
updated_at,
'credit' as transaction_type,
'transfer' as transaction_source
from transfer_body
Expand All @@ -58,6 +62,8 @@ final as (
debit_to_account_id as account_id,
cast(null as {{ dbt.type_string() }}) as class_id,
cast(null as {{ dbt.type_string() }}) as department_id,
created_at,
updated_at,
'debit' as transaction_type,
'transfer' as transaction_source
from transfer_body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ vendor_credit_join as (
coalesce(account_expense_customer_id, item_expense_customer_id) as customer_id,
coalesce(item_expense_class_id, account_expense_class_id) as class_id,
vendor_credits.vendor_id,
vendor_credits.department_id
vendor_credits.department_id,
vendor_credits.created_at,
vendor_credits.updated_at
from vendor_credits

inner join vendor_credit_lines
Expand All @@ -68,6 +70,8 @@ final as (
credit_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'vendor_credit' as transaction_source
from vendor_credit_join
Expand All @@ -86,6 +90,8 @@ final as (
debit_to_account_id as account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'vendor_credit' as transaction_source
from vendor_credit_join
Expand Down
Loading

0 comments on commit c57a9c2

Please sign in to comment.