Skip to content

Commit

Permalink
Merge pull request #17 from fivetran/bugfix/ap_ar_coalesce
Browse files Browse the repository at this point in the history
add null to coalesce
  • Loading branch information
fivetran-reneeli authored Jun 12, 2023
2 parents bf6bc69 + a691bbf commit 997ba19
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{sage_intacct__using_invoices: false, sage_intacct__using_bills: false}' --full-refresh --target "$db"
dbt run --vars '{sage_intacct__using_invoices: false, sage_intacct__using_bills: true}' --full-refresh --target "$db"
dbt run --vars '{sage_intacct__using_invoices: true, sage_intacct__using_bills: false}' --full-refresh --target "$db"
dbt test --target "$db"
dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# dbt_sage_intacct v0.UPDATE.UPDATE
# dbt_sage_intacct v0.2.2

## Add Null to Coalesce clause:
- The variables `sage_intacct__using_bills` and `sage_intacct__using_invoices` are used in coalesce statements in the `sage_intacct__ap_ar_enhanced` model. In the case where 1 is true and the other is false, the model fails for some warehouses. This is because in some warehouses like Snowflake, the coalesce clause is unable to only take 1 argument. Therefore, as a fix, this PR explicitly adds a null as a third argument. That way, for this scenario, there will still be 2 arguments. ([PR #17](https://github.com/fivetran/dbt_sage_intacct/pull/17))

## Under the Hood:
- Incorporated the new `fivetran_utils.drop_schemas_automation` macro into the end of each Buildkite integration test job.
- Updated the pull request [templates](/.github).
- Updated the pull request [templates](/.github). ([PR #15](https://github.com/fivetran/dbt_sage_intacct/pull/15))

# dbt_sage_intacct v0.2.0

Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'sage_intacct'
version: '0.2.0'
version: '0.2.2'
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
sage_intacct:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.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: 'sage_intacct_integration_tests'
version: '0.2.0'
version: '0.2.2'
config-version: 2

profile: 'integration_tests'
Expand Down
4 changes: 2 additions & 2 deletions models/sage_intacct__ap_ar_enhanced.sql
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ final as (
{% endif %}

{% if var('sage_intacct__using_invoices', True) %} invoice_id {% endif %}
) as document_id,
,null) as document_id,
coalesce(
{% if var('sage_intacct__using_bills', True) %} bill_item_id {% endif %}

Expand All @@ -157,7 +157,7 @@ final as (
{% endif %}

{% if var('sage_intacct__using_invoices', True) %} invoice_item_id {% endif %}
) as document_item_id,
,null) as document_item_id,
case
{% if var('sage_intacct__using_bills', True) %} when bill_id is not null then 'bill' {% endif %}
{% if var('sage_intacct__using_invoices', True) %} when invoice_id is not null then 'invoice' {% endif %}
Expand Down

0 comments on commit 997ba19

Please sign in to comment.