Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/too many partitions #132

Merged
merged 8 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dbt_modules/
logs/
.DS_Store
dbt_packages/
env/
env/
package-lock.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# dbt_netsuite v0.14.0

[PR #132](https://github.com/fivetran/dbt_netsuite/pull/132) includes the following updates:

## Breaking Changes (Full refresh required after upgrading)
- Partitioned models have had the `partition_by` logic adjusted to include a granularity of a month. This change should only impact BigQuery warehouses and was applied to avoid the common `too many partitions` error some users have experienced do to over partitioning by day. Therefore, adjusting the partition to a month granularity will increase the partition windows and allow for more performant querying. This change was applied to the following models:
fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved Hide resolved
- `int_netsuite2__tran_with_converted_amounts`
- `netsuite2__balance_sheet`
- `netsuite2__income_statement`
- `netsuite2__transaction_details`

## Under the Hood
- Consistency tests add for each Netsuite2 end model to be used during integration test validations.
fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved Hide resolved

# dbt_netsuite v0.13.0

For Netsuite2, [PR #116](https://github.com/fivetran/dbt_netsuite/pull/116) includes the following updates:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Include the following netsuite package version in your `packages.yml` file:
```yaml
packages:
- package: fivetran/netsuite
version: [">=0.13.0", "<0.14.0"]
version: [">=0.14.0", "<0.15.0"]
```
## Step 3: Define Netsuite.com or Netsuite2 Source
As of April 2022 Fivetran made available a new Netsuite connector which leverages the Netsuite2 endpoint opposed to the original Netsuite.com endpoint. This package is designed to run for either or, not both. By default the `netsuite_data_model` variable for this package is set to the original `netsuite` value which runs the netsuite.com version of the package. If you would like to run the package on Netsuite2 data, you may adjust the `netsuite_data_model` variable to run the `netsuite2` version of the package.
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: 'netsuite'
version: '0.13.0'
version: '0.14.0'
require-dbt-version: [">=1.3.0", "<2.0.0"]

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

Large diffs are not rendered by default.

37 changes: 5 additions & 32 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
Copy link
Contributor

Choose a reason for hiding this comment

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

@fivetran-joemarkiewicz Think you want to remove this.

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: 'netsuite_integration_tests'
version: '0.13.0'
version: '0.14.0'
profile: 'integration_tests'
config-version: 2

models:
+schema: "{{ 'netsuite_integrations_tests_sqlw' if target.name == 'databricks-sql' else 'netsuite' }}"

# +schema: "netsuite_{{ var('directed_schema','dev') }}" ## To be used for validation tests
vars:
netsuite_schema: netsuite_integration_tests_5
netsuite_data_model_override: netsuite
Expand Down Expand Up @@ -56,6 +56,7 @@ vars:
netsuite2_account_type_identifier: "netsuite2_account_type_data"
netsuite2_entity_address_identifier: "netsuite2_entity_address_data"
netsuite2_location_main_address_identifier: "netsuite2_location_main_address_data"

seeds:
+quote_columns: "{{ true if target.type in ('redshift','postgres') else false }}"
netsuite_integration_tests:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages:
- local: ../
- local: ../
45 changes: 45 additions & 0 deletions integration_tests/tests/consistency/comparison__balance_sheet.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

with prod as (
select *
from {{ target.schema }}_netsuite_prod.netsuite2__balance_sheet
),

dev as (
select *
from {{ target.schema }}_netsuite_dev.netsuite2__balance_sheet
),

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

with prod as (
select *
from {{ target.schema }}_netsuite_prod.netsuite2__income_statement
),

dev as (
select *
from {{ target.schema }}_netsuite_dev.netsuite2__income_statement
),

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

with prod as (
select *
from {{ target.schema }}_netsuite_prod.netsuite2__transaction_details
),

dev as (
select *
from {{ target.schema }}_netsuite_dev.netsuite2__transaction_details
),

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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
enabled=var('netsuite_data_model', 'netsuite') == var('netsuite_data_model_override','netsuite2'),
materialized='ephemeral' if target.type in ('bigquery', 'databricks', 'spark') else 'incremental',
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date'}
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date'],
cluster_by = ['transaction_id'],
unique_key='tran_with_converted_amounts_id',
Expand Down
2 changes: 1 addition & 1 deletion models/netsuite2/netsuite2__balance_sheet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
enabled=var('netsuite_data_model', 'netsuite') == var('netsuite_data_model_override','netsuite2'),
materialized='table' if target.type in ('bigquery', 'databricks', 'spark') else 'incremental',
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date'}
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date'],
cluster_by = ['transaction_id'],
unique_key='balance_sheet_id',
Expand Down
2 changes: 1 addition & 1 deletion models/netsuite2/netsuite2__income_statement.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
enabled=var('netsuite_data_model', 'netsuite') == var('netsuite_data_model_override','netsuite2'),
materialized='table' if target.type in ('bigquery', 'databricks', 'spark') else 'incremental',
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date'}
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date'],
cluster_by = ['transaction_id'],
unique_key='income_statement_id',
Expand Down
2 changes: 1 addition & 1 deletion models/netsuite2/netsuite2__transaction_details.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config(
enabled=var('netsuite_data_model', 'netsuite') == var('netsuite_data_model_override','netsuite2'),
materialized='table' if target.type in ('bigquery', 'databricks', 'spark') else 'incremental',
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date'}
partition_by = {'field': '_fivetran_synced_date', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date'],
cluster_by = ['transaction_id'],
unique_key='transaction_details_id',
Expand Down