Skip to content

Commit fb38df4

Browse files
authored
Bugfix/standard columns (#7)
* Remove unnecessary models * Remove source references * remove feature-based columns * Update readme * Update changelog
1 parent 479586a commit fb38df4

12 files changed

+40
-101
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1+
# dbt_netsuite_source v0.2.0
2+
3+
## 🚨 Breaking Changes 🚨:
4+
[PR #7](https://github.com/swishbi/dbt_netsuite_source/pull/7) includes the following breaking changes:
5+
- Remove columns from staging models that are feature dependent in NetSuite. These columns can be re-added via the pass through columns.
6+
7+
## 🎉 Feature Updates 🎉
8+
9+
## Contributors
10+
- [phillem15](https://github.com/phillem15) ([#7](https://github.com/swishbi/dbt_netsuite_source/pull/7))
11+
112
# dbt_netsuite_source v0.1.0
213
Refer to the relevant release notes on the Github repository for specific details for the previous releases. Thank you!

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,27 @@ To use this dbt package, you must have the **Netsuite2** (netsuite2.com) ODBC co
3535
- accountingperiodfiscalcalendar
3636
- accountingperiod
3737
- accountingbook
38-
- consolidatedexchangerate
38+
- classification
3939
- currency
4040
- customer
41-
- classification
4241
- department
42+
- employee
43+
- employeestatus
44+
- employeestatuscategory
45+
- employeetype
46+
- employeetypecategory
4347
- entity
4448
- entityaddress
4549
- item
46-
- job
50+
- itemsubtype
51+
- itemtype
4752
- location
4853
- locationmainaddress
54+
- subsidiary
55+
- transaction
4956
- transactionaccountingline
5057
- transactionline
51-
- transaction
52-
- subsidiary
58+
- transactionstatus
5359
- vendor
5460
- vendorcategory
5561

dbt_project.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ vars:
2727
netsuite_classes: "{{ source('netsuite', 'classification') }}"
2828
netsuite_consolidated_exchange_rates: "{{ source('netsuite', 'consolidated_exchange_rate') }}"
2929
netsuite_currencies: "{{ source('netsuite', 'currency') }}"
30-
netsuite_customer_address_book_entity_address: "{{ source('netsuite', 'customer_address_book_entity_address') }}"
31-
netsuite_customer_address_books: "{{ source('netsuite', 'customer_address_books') }}"
3230
netsuite_customers: "{{ source('netsuite', 'customer') }}"
33-
netsuite_deleted_records: "{{ source('netsuite', 'deleted_records') }}"
3431
netsuite_departments: "{{ source('netsuite', 'department') }}"
3532
netsuite_employee_status_categories: "{{ source('netsuite', 'employee_status_categories') }}"
3633
netsuite_employee_statuses: "{{ source('netsuite', 'employee_statuses') }}"
@@ -48,8 +45,6 @@ vars:
4845
netsuite_jobs: "{{ source('netsuite', 'job') }}"
4946
netsuite_location_main_address: "{{ source('netsuite', 'location_main_address') }}"
5047
netsuite_locations: "{{ source('netsuite', 'location') }}"
51-
netsuite_next_transaction_line_links: "{{ source('netsuite', 'next_transaction_line_links') }}"
52-
netsuite_previous_transaction_line_links: "{{ source('netsuite', 'previous_transaction_line_links') }}"
5348
netsuite_project_task_assignees: "{{ source('netsuite', 'project_task_assignees') }}"
5449
netsuite_project_tasks: "{{ source('netsuite', 'project_tasks') }}"
5550
netsuite_revenue_elements: "{{ source('netsuite', 'revenue_elements') }}"

models/_netsuite__sources.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,6 @@ sources:
618618
- name: category
619619
description: "{{ doc('vendor_category_id') }}"
620620

621-
- name: customer_address_books
622-
identifier: "{{ var('netsuite_customer_address_book_identifier', 'customeraddressbook') }}"
623-
- name: customer_address_book_entity_address
624-
identifier: "{{ var('netsuite_customer_address_book_entity_address_identifier', 'customeraddressbookentityaddress') }}"
625621
- name: employees
626622
identifier: "{{ var('netsuite_employee_identifier', 'employee') }}"
627623
- name: employee_statuses
@@ -642,8 +638,6 @@ sources:
642638
identifier: "{{ var('netsuite_job_status_identifier', 'jobstatus') }}"
643639
- name: job_types
644640
identifier: "{{ var('netsuite_job_type_identifier', 'jobtype') }}"
645-
- name: previous_transaction_line_links
646-
identifier: "{{ var('netsuite_previous_transaction_line_link_identifier', 'previoustransactionlinelink') }}"
647641
- name: project_tasks
648642
identifier: "{{ var('netsuite_project_task_identifier', 'projecttask') }}"
649643
- name: project_task_assignees

models/base/base_netsuite__customers.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ with customers as (
22
select * from {{ ref('stg_netsuite__customers') }}
33
),
44
entity_address as (
5-
select * from {{ ref('stg_netsuite__customer_address_book_entity_address') }}
5+
select * from {{ ref('stg_netsuite__entity_address') }}
66
),
77
employees as (
88
select * from {{ ref('base_netsuite__employees') }}
@@ -11,10 +11,10 @@ joined as (
1111

1212
select
1313
customers.*,
14-
entity_address.customer_city,
15-
entity_address.customer_state,
16-
entity_address.customer_zip_code,
17-
entity_address.customer_country,
14+
entity_address.city as customer_city,
15+
entity_address.state as customer_state,
16+
entity_address.zip_code as customer_zip_code,
17+
entity_address.country as customer_country,
1818
sales_rep.employee_name_last_first as sales_rep_name_last_first,
1919
sales_rep.employee_name_first_last as sales_rep_name_first_last,
2020
coalesce(parent_customer.company_name, customers.company_name) as parent_company_name,
@@ -23,7 +23,7 @@ joined as (
2323
from customers
2424

2525
left join entity_address
26-
on coalesce(customers.default_billing_address_id, customers.default_shipping_address_id) = entity_address.customer_address_book_address_id
26+
on coalesce(customers.default_billing_address_id, customers.default_shipping_address_id) = entity_address.entity_address_id
2727

2828
left join employees as sales_rep
2929
on sales_rep.employee_id = customers.sales_rep_id

models/stg_netsuite__accounts.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ renamed as (
66
accountsearchdisplaynamecopy as account_name,
77
acctnumber as account_number,
88
accttype as account_type_id,
9-
cashflowrate as cash_flow_rate_type,
109
class as class_id,
1110
{% if var('netsuite__multiple_currencies_enabled', false) %}
11+
cashflowrate as cash_flow_rate_type,
1212
currency as currency_id,
1313
generalrate as general_rate_type,
1414
{% endif %}
15-
deferralacct as deferral_account_id,
1615
department as department_id,
1716
description as account_description,
1817
externalid as account_external_id,

models/stg_netsuite__customer_address_book_entity_address.sql

Lines changed: 0 additions & 16 deletions
This file was deleted.

models/stg_netsuite__customer_address_books.sql

Lines changed: 0 additions & 12 deletions
This file was deleted.

models/stg_netsuite__items.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ renamed as (
66
assetaccount as asset_account_id,
77
class as class_id,
88
deferralaccount as deferral_account_id,
9-
deferredrevenueaccount as deferred_revenue_account_id,
109
department as department_id,
1110
description as item_sales_description,
1211
expenseaccount as expense_account_id,
1312
fullname as item_name,
1413
gainlossaccount as gain_loss_account_id,
1514
id as item_id,
1615
incomeaccount as income_account_id,
17-
intercoexpenseaccount as intercompany_expense_account_id,
18-
intercoincomeaccount as intercompany_income_account_id,
19-
isfulfillable = 'T' as is_fulfillable,
2016
itemtype as item_type_id,
2117
lastmodifieddate as last_modified_date,
2218
location as location_id,

models/stg_netsuite__previous_transaction_line_links.sql

Lines changed: 0 additions & 18 deletions
This file was deleted.

models/stg_netsuite__transaction_lines.sql

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,26 @@ with source as (
33
),
44
renamed as (
55
select
6-
actualshipdate as actual_ship_date,
6+
id as transaction_line_id,
7+
transaction as transaction_id,
78
class as class_id,
8-
costestimaterate as cost_estimate_rate,
9-
createdfrom as created_from_id,
10-
createdpo as created_po_id,
119
department as department_id,
12-
dropship = 'T' as is_drop_shipment,
1310
entity as entity_id,
14-
id as transaction_line_id,
15-
isbillable = 'T' as is_billable,
16-
isclosed = 'T' as is_closed,
17-
iscogs = 'T' as is_cogs,
18-
isfullyshipped = 'T' as is_fully_shipped,
19-
isinventoryaffecting = 'T' as is_inventory_affecting,
11+
location as location_id,
2012
item as item_id,
13+
subsidiary as subsidiary_id,
2114
linelastmodifieddate as line_last_modified_date,
2215
linesequencenumber as line_sequence_number,
23-
location as location_id,
24-
mainline = 'T' as is_main_line,
2516
memo,
2617
quantity,
27-
quantitybackordered as quantity_back_ordered,
28-
quantitybilled as quantity_billed,
29-
quantitycommitted as quantity_committed,
30-
quantitypacked as quantity_packed,
31-
quantitypicked as quantity_picked,
32-
quantityshiprecv as quantity_shipped_received,
3318
rate,
34-
specialorder = 'T' as is_special_order,
35-
subsidiary as subsidiary_id,
36-
taxline = 'T' as is_tax_line,
37-
transaction as transaction_id,
38-
uniquekey as transaction_line_unique_key
19+
cleared = 'T' as is_cleared,
20+
commitmentfirm = 'T' as is_commitment_firm,
21+
isbillable = 'T' as is_billable,
22+
isclosed = 'T' as is_closed,
23+
iscogs = 'T' as is_cogs,
24+
mainline = 'T' as is_main_line,
25+
taxline = 'T' as is_tax_line
3926

4027
--The below macro adds the fields defined within your transaction_lines_pass_through_columns variable into the staging model
4128
{{ fivetran_utils.fill_pass_through_columns('transaction_lines_pass_through_columns') }}

models/stg_netsuite__transactions.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ renamed as (
1111
duedate as transaction_due_date,
1212
employee as employee_id,
1313
entity as entity_id,
14-
expectedclosedate as transaction_expected_close_date,
1514
id as transaction_id,
16-
intercoadj = 'T' as is_transaction_intercompany_adjustment,
1715
isreversal = 'T' as is_transaction_reversal,
1816
lastmodifieddate as last_modified_date,
1917
memo as transaction_memo,
@@ -24,7 +22,6 @@ renamed as (
2422
tranid as transaction_name,
2523
transactionnumber as transaction_number,
2624
type as transaction_type,
27-
voided = 'T' as is_transaction_voided,
2825

2926
concat('https://{{ var("netsuite_account_id", "123456") }}.app.netsuite.com/app/accounting/transactions/', lower(type), '.nl?id=', id) as transaction_url_link,
3027
concat(type,'_',id) as reference_id

0 commit comments

Comments
 (0)