Skip to content

Commit

Permalink
Merge pull request #36 from fivetran/bugfix/evancole-untitled-casting
Browse files Browse the repository at this point in the history
Bugfix/evancole untitled casting
  • Loading branch information
fivetran-joemarkiewicz authored Apr 19, 2022
2 parents 5fe806b + 549e30e commit 8418102
Show file tree
Hide file tree
Showing 24 changed files with 44 additions and 41 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# dbt_quickbooks v0.5.0
## 🚨 Breaking Changes 🚨
- It was discovered that IDs from the source tables can sometimes be strings. The previous build of the package interpreted all IDs as integers. To ensure the package operates as intended, the package has been updated to cast all IDs to the string datatype. If you were leveraging the end models in downstream analysis, this change could break your join conditions. Be sure to be aware of any join conditions you may have downstream before upgrading your QuickBooks package. (#36)[https://github.com/fivetran/dbt_quickbooks/pull/36]
# dbt_quickbooks v0.4.0
🎉 dbt v1.0.0 Compatibility 🎉
## 🚨 Breaking Changes 🚨
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Include in your `packages.yml`
```yaml
packages:
- package: fivetran/quickbooks
version: [">=0.4.0", "<0.5.0"]
version: [">=0.5.0", "<0.6.0"]
```
## Configuration
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: '0.4.0'
version: '0.5.0'

require-dbt-version: [">=1.0.0", "<2.0.0"]

Expand Down
2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'quickbooks_integration_tests'
version: '0.3.0'
version: '0.5.0'
profile: 'integration_tests'
config-version: 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final as (
select
transaction_id,
transaction_date,
cast(null as {{ dbt_utils.type_int() }}) as customer_id,
cast(null as {{ dbt_utils.type_string() }}) as customer_id,
vendor_id,
amount,
payment_account_id as account_id,
Expand All @@ -60,7 +60,7 @@ final as (
select
transaction_id,
transaction_date,
cast(null as {{ dbt_utils.type_int() }}) as customer_id,
cast(null as {{ dbt_utils.type_string() }}) as customer_id,
vendor_id,
amount,
account_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount * -1 as amount,
account_id,
'credit' as transaction_type,
Expand All @@ -70,7 +70,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount * -1 as amount,
df_accounts.account_id,
'debit' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
deposit_to_acct_id as account_id,
'debit' as transaction_type,
Expand All @@ -65,7 +65,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
deposit_from_acct_id as account_id,
'credit' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
account_id,
'credit' as transaction_type,
Expand All @@ -136,7 +136,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
ar_accounts.account_id,
'debit' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
deposit_to_account_id as account_id,
'debit' as transaction_type,
Expand All @@ -59,7 +59,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
coalesce(receivable_account_id, ar_accounts.account_id) as account_id,
'credit' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
credit_to_account_id as account_id,
'credit' as transaction_type,
Expand All @@ -62,7 +62,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
debit_account_id as account_id,
'debit' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
debit_to_account_id as account_id,
'debit' as transaction_type,
Expand All @@ -62,7 +62,7 @@ final as (
transaction_id,
transaction_date,
customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
credit_to_account_id as account_id,
'credit' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ final as (
select
transaction_id,
transaction_date,
cast(null as {{ dbt_utils.type_int() }}) as customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as customer_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
credit_to_account_id as account_id,
'credit' as transaction_type,
Expand All @@ -37,8 +37,8 @@ final as (
select
transaction_id,
transaction_date,
cast(null as {{ dbt_utils.type_int() }}) as customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as customer_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
amount,
debit_to_account_id as account_id,
'debit' as transaction_type,
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/int_quickbooks__bill_join.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bill_link as (

final as (
select
'bill' as transaction_type,
cast('bill' as {{ dbt_utils.type_string() }}) as transaction_type,
bill_link.bill_id as transaction_id,
bill_link.doc_number,
bill_link.department_id,
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/int_quickbooks__expenses_union.sql
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final as (
expense_union.doc_number,
expense_union.transaction_type,
expense_union.transaction_date,
cast(null as {{ dbt_utils.type_int() }}) as item_id,
cast(null as {{ dbt_utils.type_string() }}) as item_id,
cast(null as {{ dbt_utils.type_numeric() }}) as item_quantity,
cast(null as {{ dbt_utils.type_numeric() }}) as item_unit_price,
expense_union.account_id,
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/int_quickbooks__invoice_join.sql
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ invoice_link as (

final as (
select
'invoice' as transaction_type,
cast('invoice' as {{ dbt_utils.type_string() }}) as transaction_type,
invoice_link.invoice_id as transaction_id,
invoice_link.doc_number,
invoice_link.estimate_id,
Expand Down
16 changes: 8 additions & 8 deletions models/intermediate/int_quickbooks__retained_earnings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ net_income_loss as (

retained_earnings_starter as (
select
9999 as account_id,
'9999-00' as account_number,
'Net Income / Retained Earnings Adjustment' as account_name,
cast('9999' as {{ dbt_utils.type_string() }}) as account_id,
cast('9999-00' as {{ dbt_utils.type_string() }}) as account_number,
cast('Net Income / Retained Earnings Adjustment' as {{ dbt_utils.type_string() }}) as account_name,
false as is_sub_account,
cast(null as {{ dbt_utils.type_string() }}) as parent_account_number,
cast(null as {{ dbt_utils.type_string() }}) as parent_account_name,
'Equity' as account_type,
'RetainedEarnings' as account_sub_type,
'Equity' as account_class,
'balance_sheet' as financial_statement_helper,
cast('Equity' as {{ dbt_utils.type_string() }}) as account_type,
cast('RetainedEarnings' as {{ dbt_utils.type_string() }})as account_sub_type,
cast('Equity' as {{ dbt_utils.type_string() }}) as account_class,
cast('balance_sheet' as {{ dbt_utils.type_string() }}) as financial_statement_helper,
cast({{ dbt_utils.date_trunc("year", "period_first_day") }} as date) as date_year,
cast(period_first_day as date) as period_first_day,
{{ dbt_utils.last_day("period_first_day", "month") }} as period_last_day,
Expand Down Expand Up @@ -83,4 +83,4 @@ final as (
)

select *
from final
from final
2 changes: 1 addition & 1 deletion models/quickbooks__ap_ar_enhanced.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final as (
transaction_type,
transaction_id,
doc_number,
cast(null as {{ dbt_utils.type_int() }}) as estimate_id,
cast(null as {{ dbt_utils.type_string() }}) as estimate_id,

{% if var('using_department', True) %}
departments.fully_qualified_name as department_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final as (
credit_memos.class_id,
credit_memos.department_id,
credit_memos.customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as billable_status,
credit_memo_lines.description,
credit_memo_lines.amount * -1 as amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final as (
deposit_lines.deposit_class_id as class_id,
deposits.department_id,
deposit_lines.deposit_customer_id as customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as billable_status,
deposit_lines.description,
deposit_lines.amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final as (
coalesce(invoice_lines.discount_class_id, invoice_lines.sales_item_class_id) as class_id,
invoices.department_id,
invoices.customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as billable_status,
invoice_lines.description,
invoice_lines.amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final as (
refund_receipts.class_id,
refund_receipts.department_id,
refund_receipts.customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as billable_status,
refund_receipt_lines.description,
refund_receipt_lines.amount * -1 as amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final as (
sales_receipts.class_id,
sales_receipts.department_id,
sales_receipts.customer_id,
cast(null as {{ dbt_utils.type_int() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as vendor_id,
cast(null as {{ dbt_utils.type_string() }}) as billable_status,
sales_receipt_lines.description,
sales_receipt_lines.amount,
Expand Down
4 changes: 2 additions & 2 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- package: fivetran/quickbooks_source
version: [">=0.4.0", "<0.5.0"]
- package: fivetran/quickbooks_source
version: [">=0.5.0", "<0.6.0"]

0 comments on commit 8418102

Please sign in to comment.