Skip to content

Commit bd22af7

Browse files
Merge pull request #57 from fivetran/feature/add-employees-model-timestamp-fixes-common-fields
[Feature] Add employees model, timestamp fixes, add common fields
2 parents 991a4d6 + 8f8a863 commit bd22af7

32 files changed

+312
-41
lines changed

.buildkite/scripts/run_models.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ dbt seed --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw}' --t
2222
dbt compile --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw}' --target "$db"
2323
dbt run --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw}' --target "$db" --full-refresh
2424
dbt test --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw}' --target "$db"
25-
dbt run --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw, netsuite2__multibook_accounting_enabled: false, netsuite2__using_exchange_rate: false, netsuite2__using_vendor_categories: false, netsuite2__using_jobs: false}' --target "$db" --full-refresh
25+
dbt run --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw, netsuite2__multibook_accounting_enabled: false, netsuite2__using_exchange_rate: false, netsuite2__using_vendor_categories: false, netsuite2__using_jobs: false, netsuite2__using_employees: false}' --target "$db" --full-refresh
2626
dbt test --vars '{netsuite_schema: netsuite_source_integrations_tests_sqlw}' --target "$db"
2727

2828
else
2929

3030
dbt seed --target "$db" --full-refresh
3131
dbt run --target "$db" --full-refresh
3232
dbt test --target "$db"
33-
dbt run --vars '{netsuite2__multibook_accounting_enabled: false, netsuite2__using_exchange_rate: false, netsuite2__using_vendor_categories: false, netsuite2__using_jobs: false}' --target "$db" --full-refresh
33+
dbt run --vars '{netsuite2__multibook_accounting_enabled: false, netsuite2__using_exchange_rate: false, netsuite2__using_vendor_categories: false, netsuite2__using_jobs: false, netsuite2__using_employees: false}' --target "$db" --full-refresh
3434
dbt test --target "$db"
3535
fi
3636

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
# dbt_netsuite_source v0.11.0
2+
[PR #57](https://github.com/fivetran/dbt_netsuite_source/pull/57) includes the following update:
3+
4+
## Breaking Changes
5+
- Casted specific timestamp fields across all staging models as dates where the Netsuite UI does not perform timezone conversion. Keeping these fields as type timestamp causes issues in reporting tools that perform automatic timezone conversion.
6+
- As this will change the datatype of the underlying fields, this will require a `--full-refresh` for downstream incremental models.
7+
- Existing fields that were converted from timestamp to date in the following `stg_netsuite2__*` models:
8+
9+
| **Table** | **Source Field Name** | **Field Alias** |
10+
| -------- | ------- | ------- |
11+
| accounting_periods | startdate | starting_at |
12+
| accounting_periods | enddate | ending_at |
13+
| customers | firstorderdate | date_first_order_at |
14+
| transactions | closedate | closed_at |
15+
| transactions | duedate | due_date_at |
16+
| transactions | trandate | transaction_date |
17+
18+
- Adds additional commonly used fields within the `stg_netsuite2__*` models.
19+
20+
| **Table** | **Source Field Name** | **Field Alias** |
21+
| -------- | ------- | ------- |
22+
| accounts | accountsearchdisplaynamecopy | display_name |
23+
| customers | altname | alt_name |
24+
| subsidiaries | iselimination | is_elimination |
25+
| transaction_accounting_lines | exchangerate | exchange_rate |
26+
| transaction_lines | eliminate | is_eliminate |
27+
| transaction_lines | netamount | netamount |
28+
| transactions | reversal | reversal_transaction_id |
29+
| transactions | reversaldate | reversal_date |
30+
| transactions | reversaldefer | is_reversal_defer |
31+
32+
> **IMPORTANT**: Nearly all of the affected models have pass-through functionality. If you have already been using passthrough column variables to include the above newly added fields (without aliases), you **MUST** remove the fields from your passthrough variable configuration in order to avoid duplicate column errors.
33+
34+
## Feature Updates
35+
- Introduced the `stg_netsuite2__employees` model to bring in data from the `employee` source table.
36+
- Since this model is only used by a subset of customers, we've introduced the variable `netsuite2__using_employees` to allow users who don't utilize the `employee` table in Netsuite2 the ability to disable that functionality within your `dbt_project.yml`. This value is set to true by default. [Instructions are available in the README for how to disable this variable](https://github.com/fivetran/dbt_netsuite_source/?tab=readme-ov-file#step-5-disable-models-for-non-existent-sources-netsuite2-only).
37+
38+
## Under the Hood
39+
- Created new seed data in `integration_tests` to support the new `stg_netsuite2__employees` model, as well as the new fields introduced into the new Netsuite2 staging models.
40+
41+
## Contributors
42+
- [@jmongerlyra](https://github.com/jmongerlyra) ([PR #54](https://github.com/fivetran/dbt_netsuite_source/pull/54))
43+
144
# dbt_netsuite_source v0.10.1
245
[PR #51](https://github.com/fivetran/dbt_netsuite_source/pull/51) includes the following update:
346

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ To use this dbt package, you must have At least either one Fivetran **Netsuite**
5959
- customer
6060
- classification
6161
- department
62+
- employee
6263
- entity
6364
- entityaddress
6465
- item
@@ -89,7 +90,7 @@ If you are **not** using the [Netsuite transformation package](https://github.c
8990
```yaml
9091
packages:
9192
- package: fivetran/netsuite_source
92-
version: [">=0.10.0", "<0.11.0"]
93+
version: [">=0.11.0", "<0.12.0"]
9394
```
9495

9596
### Step 3: Define Netsuite.com or Netsuite2 Source
@@ -116,8 +117,10 @@ vars:
116117
netsuite2__using_exchange_rate: false #True by default. Disable `exchange_rate` if you don't utilize exchange rates. If you set this variable to false and are using the `netsuite` transformation package, ensure it is scoped globally so that the `netsuite` package can access it as well.
117118
netsuite2__using_vendor_categories: false # True by default. Disable `vendorcategory` if you don't categorize your vendors
118119
netsuite2__using_jobs: false # True by default. Disable `job` if you don't use jobs
120+
netsuite2__using_employees: false # True by default. Disable `employee` if you don't use employees.
119121

120122
```
123+
121124
> **Note**: The Netsuite dbt package currently only supports disabling transforms of [Multi-Book Accounting](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/book_3831565332.html) related tables (`accountingbooksubsidiary` and `accountingbook`), the `vendorcategory` source table, and the `job` source table. Please create an issue to request additional tables and/or [features](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/bridgehead_N233872.html) to exclude.
122125
>
123126
> To determine if a table or field is activated by a feature, access the [Records Catalog](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_159367781370.html).

dbt_project.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
config-version: 2
22
require-dbt-version: [">=1.3.0", "<2.0.0"]
33
name: 'netsuite_source'
4-
version: '0.10.1'
4+
version: '0.11.0'
55

66
models:
77
netsuite_source:
@@ -41,6 +41,7 @@ vars:
4141
netsuite2_currencies: "{{ source('netsuite2','currency') }}"
4242
netsuite2_customers: "{{ source('netsuite2','customer') }}"
4343
netsuite2_departments: "{{ source('netsuite2','department') }}"
44+
netsuite2_employees: "{{ source('netsuite2','employee') }}"
4445
netsuite2_entities: "{{ source('netsuite2','entity') }}"
4546
netsuite2_items: "{{ source('netsuite2','item') }}"
4647
netsuite2_jobs: "{{ source('netsuite2','job') }}"

docs/catalog.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/manifest.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/run_results.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

integration_tests/ci/sample.profiles.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ integration_tests:
1616
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
1717
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
1818
port: 5439
19-
schema: netsuite_source_integration_tests_3
19+
schema: netsuite_source_integration_tests_6
2020
threads: 8
2121
bigquery:
2222
type: bigquery
2323
method: service-account-json
2424
project: 'dbt-package-testing'
25-
schema: netsuite_source_integration_tests_3
25+
schema: netsuite_source_integration_tests_6
2626
threads: 8
2727
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
2828
snowflake:
@@ -33,7 +33,7 @@ integration_tests:
3333
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
3434
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
3535
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
36-
schema: netsuite_source_integration_tests_3
36+
schema: netsuite_source_integration_tests_6
3737
threads: 8
3838
postgres:
3939
type: postgres
@@ -42,13 +42,13 @@ integration_tests:
4242
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
4343
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
4444
port: 5432
45-
schema: netsuite_source_integration_tests_3
45+
schema: netsuite_source_integration_tests_6
4646
threads: 8
4747
databricks:
4848
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
4949
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
5050
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
51-
schema: netsuite_source_integration_tests_3
51+
schema: netsuite_source_integration_tests_6
5252
threads: 8
5353
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
5454
type: databricks

integration_tests/dbt_project.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: 'netsuite_source_integration_tests'
22

3-
version: '0.10.1'
3+
version: '0.11.0'
44

55
profile: 'integration_tests'
66
config-version: 2
77

88
vars:
99
netsuite_source:
10-
netsuite_schema: netsuite_source_integration_tests_3
10+
netsuite_schema: netsuite_source_integration_tests_6
1111
netsuite_data_model_override: netsuite
1212
netsuite_accounting_books_identifier: "netsuite_accounting_books_data"
1313
netsuite_accounting_periods_identifier: "netsuite_accounting_periods_data"
@@ -34,6 +34,7 @@ vars:
3434
netsuite2_currency_identifier: "netsuite2_currency_data"
3535
netsuite2_customer_identifier: "netsuite2_customer_data"
3636
netsuite2_department_identifier: "netsuite2_department_data"
37+
netsuite2_employee_identifier: "netsuite2_employee_data"
3738
netsuite2_entity_identifier: "netsuite2_entities_data"
3839
netsuite2_item_identifier: "netsuite2_item_data"
3940
netsuite2_job_identifier: "netsuite2_job_data"

integration_tests/seeds/netsuite2_customer_data.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
id,_fivetran_deleted,_fivetran_synced,accountnumber,alcoholrecipienttype,altemail,altname,altphone,assignedwebsite,balancesearch,billingratecard,billingschedule,billingtransactiontype,billpay,buyingreason,buyingtimeframe,campaignevent,category,clickstream,comments,companyname,consolbalancesearch,consoldaysoverduesearch,consoloverduebalancesearch,consolunbilledorderssearch,contact,contactlist,creditholdoverride,creditlimit,currency,custentity1,custentity10,custentity12,custentity13,custentity14,custentity15,custentity16,custentity18,custentity21,custentity4,custentity5,custentity6,custentity7,custentity8,custentity9,custentity_2663_customer_refund,custentity_2663_direct_debit,custentity_cust_priority,custentity_fmt_cur_sales_order,custentity_fmt_cust_credit_on_hold,custentity_fmt_customer_credit_on_hold,custentity_lead_category,custentity_ppob,custentity_supervisor,date_deleted,datecreated,defaultbankaccount,defaultbillingaddress,defaultorderpriority,defaultshippingaddress,duplicate,email,emailpreference,emailtransactions,enddate,entityid,entitynumber,entitystatus,entitytitle,estimatedbudget,externalid,fax,faxtransactions,firstname,firstorderdate,firstsaledate,firstvisit,giveaccess,globalsubscriptionstatus,homephone,isbudgetapproved,isinactive,isperson,keywords,language,lastmodifieddate,lastname,lastorderdate,lastpagevisited,lastsaledate,lastvisit,leadsource,middlename,mobilephone,negativenumberformat,numberformat,oncredithold,overduebalancesearch,parent,partner,phone,prefccprocessor,pricelevel,printoncheckas,printtransactions,probability,receivablesaccount,referrer,reminderdays,resalenumber,salesreadiness,salesrep,salutation,searchstage,shipcomplete,shippingcarrier,shippingitem,sourcewebsite,startdate,terms,territory,thirdpartyacct,thirdpartycarrier,thirdpartycountry,thirdpartyzipcode,title,unbilledorderssearch,url,visits,weblead,dateclosed
2-
1409,FALSE,2022-05-27 13:17:39,,,,Joe Shmoe,,,0,,,,F,,,,,,,,0,0,0,0,,,AUTO,,1,,,,,,,,F,,,,,,,,,,50,,F,,2,,,,2017-05-27 8:56:10,,,,,T,jm@fake.com,DEFAULT,F,,CCS,,6,Joe Shmoe,,,,F,Joe,,,,F,1,,F,F,T,,en_US,2017-05-09 6:07:35,Li,,,,,,,,,,F,0,,,,,,,F,0,-10,,,,,1008,,Lead,F,nonups,,,,2,,,,,,,0,,,F,2017-05-27 0:00:00
2+
1409,FALSE,2022-05-27 13:17:39,,,,Joe Shmoe,,,0,,,,F,,,,,,,,0,0,0,0,,,AUTO,,1,,,,,,,,F,,,,,,,,,,50,,F,,2,,,,2017-05-27 8:56:10,,,,,T,jm@fake.com,DEFAULT,F,,CCS,,6,Joe Shmoe,,,,F,Joe,2017-05-07 0:00:00,,,F,1,,F,F,T,,en_US,2017-05-09 6:07:35,Li,,,,,,,,,,F,0,,,,,,,F,0,-10,,,,,1008,,Lead,F,nonups,,,,2,,,,,,,0,,,F,2017-05-27 0:00:00
33
1408,FALSE,2022-05-27 13:17:39,,,,Fake Name,,,0,,,,F,,,,,,,,0,0,0,0,,,AUTO,,1,,,,,,,,F,,,,,,,,,,50,,F,,2,,,,2017-05-27 8:52:49,,,,,T,jm@fake.com,DEFAULT,F,,CCS,,6,Fake Name,,,,F,Fake,,,,F,1,,F,F,T,,en_US,2017-05-09 6:07:33,Li,,,,,,,,,,F,0,,,,,,,F,0,-10,,,,,1008,,Lead,F,nonups,,,,2,,,,,,,0,,,F,2017-05-27 0:00:00
44
1388,FALSE,2022-05-27 13:17:39,,,,Jess is Best,,,0,,,,F,,,,,Cat > Couch,,,0,0,0,0,,,AUTO,,1,,,,,,,,F,,,3,,,,,,,50,,,,,,,,2017-05-10 19:14:00,,,,,T,jm@fake.com,DEFAULT,F,,CCS,,6,Jess is Best,,,,F,Jess,,,2017-05-10 10:07:29,T,2,,F,F,T,,en_US,2017-05-09 6:07:26,Best,,,,2017-05-23 8:15:26,,,,,,F,0,,,,,,,F,0,-10,,,,,,,Lead,F,nonups,,,,2,8,,,,,,0,,11,T,2017-05-10 0:00:00
55
1440,FALSE,2022-05-27 13:17:39,,,,Cedar Cat,,,0,,,,F,,,,,Cat,,CCS,0,0,0,0,,,AUTO,,1,,,,,,,,F,,,,,,,,,,50,,F,F,,,,,2017-05-11 21:46:11,,,,,T,jm@fake.com,DEFAULT,F,,CCS,7,6,Cedar Cat,,,,F,,,,2017-05-11 14:45:51,F,1,,F,F,F,,en_US,2017-05-09 6:07:47,,,,,2017-05-11 15:17:17,100237,,,,,F,0,,,,,,,F,0,-10,,,,,,,Lead,F,nonups,,,,2,,,,,,,0,,3,F,2017-05-11 0:00:00

0 commit comments

Comments
 (0)