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

Feature/add union data #43

Open
wants to merge 20 commits into
base: release/v0.10.0-apr-2024
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d7ebb4e
Adding the fivetran_utils.union_data macro to the _tmp models
fivetran-poonamagate Jan 10, 2024
169232a
Persisting the source_relation column to the non-_tmp staging models
fivetran-poonamagate Jan 10, 2024
0a23f92
Adding source_relation to the stg_netsuite2.yml file and including so…
fivetran-poonamagate Jan 10, 2024
def9956
Adding the logic to disable the default source if unioning is occurri…
fivetran-poonamagate Jan 10, 2024
8b6794e
Adding to the README.md file and light mop ups
fivetran-poonamagate Jan 12, 2024
6c5d205
Updating the CHANGELOG and dbt_project.yml files
fivetran-poonamagate Jan 12, 2024
dca017c
Updating the config parameters in the src_netsuite2.yml file
fivetran-poonamagate Jan 12, 2024
c5a585d
Updating the CHANGELOG
fivetran-poonamagate Jan 12, 2024
ca71e2d
make use of new connector_table_name_override argument in union_data …
fivetran-jamie Jan 16, 2024
49d9064
try this out
fivetran-jamie Jan 26, 2024
abfea30
readme addition
fivetran-jamie Jan 30, 2024
2376a3f
integration test variable scoping is weird, let's try adding it to CL…
fivetran-jamie Jan 30, 2024
3e15563
change scope...again
fivetran-jamie Jan 30, 2024
280e3b9
docs and change identifier var name
fivetran-jamie Jan 31, 2024
604a968
polishes and testing out using identifier vars for most but not all s…
fivetran-jamie Jan 31, 2024
e184b6e
Readme
fivetran-jamie Jan 31, 2024
415bbd3
Revert seed name change
fivetran-jamie Jan 31, 2024
24e0685
github stuff
fivetran-jamie Feb 1, 2024
774bb19
joe feedback
fivetran-jamie Feb 5, 2024
d8eee73
swap source defintiion reference
fivetran-jamie Feb 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
### Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
- [ ] dbt run –full-refresh && dbt test
- [ ] dbt run (if incremental models are present)
- [ ] dbt run (if incremental models are present) && dbt test

Before marking this PR as "ready for review" the following have been applied:
- [ ] The appropriate issue has been linked, tagged, and properly assigned
- [ ] All necessary documentation and version upgrades have been applied
<!--- Be sure to update the package version in the dbt_project.yml, integration_tests/dbt_project.yml, and README if necessary. -->
- [ ] docs were regenerated (unless this PR does not include any code or yml updates)
- [ ] BuildKite integration tests are passing
- [ ] Detailed validation steps have been provided below

### Detailed Validation
Please share any and all of your validation steps:
<!--- Provide the steps you took to validate your changes below. -->

### If you had to summarize this PR in an emoji, which would it be?
<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) -->
:dancer:
13 changes: 13 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'auto release'
on:
pull_request:
types:
- closed
branches:
- main

jobs:
call-workflow-passing-data:
if: github.event.pull_request.merged
uses: fivetran/dbt_package_automations/.github/workflows/auto-release.yml@main
secrets: inherit
35 changes: 35 additions & 0 deletions .github/workflows/check_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'check docs'
Copy link
Contributor

Choose a reason for hiding this comment

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

Request to remove this as we will use a different method this year to check docs.

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
changed-files:
runs-on: ubuntu-latest
name: test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: docs/**

- name: Check to see if docs folder hasn't changed
if: steps.changed-files.outputs.any_changed == 'false'
run: |
echo "Docs have not been regenerated."
exit 1

- name: Check if docs folder has changed
if: steps.changed-files.outputs.any_changed == 'true'
run: |
echo "Docs have been regenerated!"
exit 0
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# dbt_netsuite_source v0.10.0

## 🎉 Feature Update 🎉
- This release supports running the package on multiple Netsuite sources at once! See the [README](https://github.com/fivetran/dbt_netsuite_source/tree/main?tab=readme-ov-file#step-4-define-database-and-schema-variables) for details on how to leverage this feature ([PR #43](https://github.com/fivetran/dbt_netsuite_source/pull/43)).

## 🛠️ Under the Hood 🛠️
- Included auto-releaser GitHub Actions workflow to automate future releases.
- Included Github Actions workflow to check for docs updates.
- Updated the maintainer PR template to resemble the most up to date format.

## Contributors:
- [@fivetran-poonamagate](https://github.com/fivetran-poonamagate) ([PR #43](https://github.com/fivetran/dbt_netsuite_source/pull/43))

# dbt_netsuite_source v0.9.0
[PR #42](https://github.com/fivetran/dbt_netsuite_source/pull/42) includes the following update:
## 🚨 Breaking Changes 🚨:
Expand Down
654 changes: 648 additions & 6 deletions README.md

Large diffs are not rendered by default.

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
require-dbt-version: [">=1.3.0", "<2.0.0"]
name: 'netsuite_source'
version: '0.9.0'
version: '0.10.0'

models:
netsuite_source:
Expand Down
1 change: 1 addition & 0 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ profile: 'integration_tests'
config-version: 2
vars:
netsuite_source:
use_table_name_identifer_override: true # to use seed identifiers in integration tests
netsuite_schema: netsuite_source_integration_tests_3
netsuite_data_model_override: netsuite
netsuite_accounting_books_identifier: "netsuite_accounting_books_data"
Expand Down
2 changes: 1 addition & 1 deletion models/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

{% docs addr3 %} The associated address 3. {% enddocs %}

{% docs addressee %} The individual associated with the address {% enddocs %}
{% docs addressee %} The individual associated with the address. {% enddocs %}

{% docs full_address %} The full address associated. {% enddocs %}

Expand Down
6 changes: 3 additions & 3 deletions models/netsuite2/src_netsuite2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sources:
loader: fivetran
loaded_at_field: _fivetran_synced
config:
enabled: "{{ var('netsuite_data_model', 'netsuite') == var('netsuite_data_model_override','netsuite2') }}"
enabled: "{{ var('netsuite_data_model', 'netsuite') == var('netsuite_data_model_override','netsuite2') and var('netsuite2_union_schemas', []) == [] and var('netsuite2_union_databases', []) == [] }}"
freshness:
warn_after: { count: 24, period: hour }
error_after: { count: 48, period: hour }
Expand Down Expand Up @@ -197,7 +197,7 @@ sources:
description: "{{ doc('consolidated_exchange_rates_table') }}"
columns:
- name: id
description: unique identifier for the consolidated exchange rate.
description: Unique identifier for the consolidated exchange rate.
- name: postingperiod
description: "{{ doc('accounting_period_id') }}"
- name: fromcurrency
Expand Down Expand Up @@ -291,7 +291,7 @@ sources:
description: "{{ doc('entities_table') }}"
columns:
- name: id
description: Th "{{ doc('entity_id') }}"e unique identifier of the entity.
description: "{{ doc('entity_id') }}"
- name: contact
description: The unique identifier of the contact associated with the entity.
- name: customer
Expand Down
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__account_types.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_accounttype_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -34,10 +40,11 @@ final as (
{%- else -%}
left
{%- endif -%} = 'T' as is_leftside,
longname as type_name
longname as type_name,
source_relation

from fields
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__accounting_book_subsidiaries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_accountingbooksubsidiaries_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -25,11 +31,12 @@ final as (
_fivetran_synced,
accountingbook as accounting_book_id,
status,
subsidiary as subsidiary_id
subsidiary as subsidiary_id,
source_relation

from fields
where not coalesce(_fivetran_deleted, false)
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__accounting_books.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_netsuite2_accounting_books_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -30,10 +36,11 @@ final as (
isconsolidated = 'T' as is_consolidated,
contingentrevenuehandling as is_contingent_revenue_handling,
isprimary = 'T' as is_primary,
twosteprevenueallocation as is_two_step_revenue_allocation
twosteprevenueallocation as is_two_step_revenue_allocation,
source_relation
from fields
where not coalesce(_fivetran_deleted, false)
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__accounting_period_fiscal_cal.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_accountingperiodfiscalcalendars_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -25,10 +31,11 @@ final as (
_fivetran_synced,
accountingperiod as accounting_period_id,
fiscalcalendar as fiscal_calendar_id,
parent as parent_id
parent as parent_id,
source_relation
from fields
where not coalesce(_fivetran_deleted, false)
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__accounting_periods.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ fields as (
staging_columns=get_netsuite2_accounting_periods_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -36,10 +42,11 @@ final as (
closed = 'T' as is_closed,
alllocked = 'T' as is_all_locked,
arlocked = 'T' as is_ar_locked,
aplocked = 'T' as is_ap_locked
aplocked = 'T' as is_ap_locked,
source_relation
from fields
where not coalesce(_fivetran_deleted, false)
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__accounts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_netsuite2_accounts_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -41,7 +47,8 @@ final as (
isinactive = 'T' as is_inactive,
issummary = 'T' as is_summary,
eliminate = 'T' as is_eliminate,
_fivetran_deleted
_fivetran_deleted,
source_relation

--The below macro adds the fields defined within your accounts_pass_through_columns variable into the staging model
{{ fivetran_utils.fill_pass_through_columns('accounts_pass_through_columns') }}
Expand All @@ -50,4 +57,4 @@ final as (
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__classes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_netsuite2_classes_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -27,7 +33,8 @@ final as (
name,
fullname as full_name,
isinactive = 'T' as is_inactive,
_fivetran_deleted
_fivetran_deleted,
source_relation

--The below macro adds the fields defined within your classes_pass_through_columns variable into the staging model
{{ fivetran_utils.fill_pass_through_columns('classes_pass_through_columns') }}
Expand All @@ -36,4 +43,4 @@ final as (
)

select *
from final
from final
11 changes: 9 additions & 2 deletions models/netsuite2/stg_netsuite2__consolidated_exchange_rates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ fields as (
staging_columns=get_netsuite2_consolidated_exchange_rates_columns()
)
}}

{{ fivetran_utils.source_relation(
union_schema_variable='netsuite2_union_schemas',
union_database_variable='netsuite2_union_databases')
}}

from base
),

Expand All @@ -30,7 +36,8 @@ final as (
accountingbook as accounting_book_id,
currentrate as current_rate,
averagerate as average_rate,
historicalrate as historical_rate
historicalrate as historical_rate,
source_relation

--The below macro adds the fields defined within your consolidated_exchange_rates_pass_through_columns variable into the staging model
{{ fivetran_utils.fill_pass_through_columns('consolidated_exchange_rates_pass_through_columns') }}
Expand All @@ -40,4 +47,4 @@ final as (
)

select *
from final
from final
Loading
Loading