{"id":22793252,"url":"https://github.com/fivetran/dbt_netsuite","last_synced_at":"2025-04-07T10:29:25.966Z","repository":{"id":43452166,"uuid":"249819935","full_name":"fivetran/dbt_netsuite","owner":"fivetran","description":"Data models for Fivetran's Netsuite connector, built using dbt. ","archived":false,"fork":false,"pushed_at":"2025-03-25T22:51:45.000Z","size":6080,"stargazers_count":40,"open_issues_count":14,"forks_count":36,"subscribers_count":41,"default_branch":"main","last_synced_at":"2025-03-31T09:06:36.547Z","etag":null,"topics":["dbt","dbt-packages","fivetran","fivetran-finance-reporting","netsuite"],"latest_commit_sha":null,"homepage":"https://fivetran.github.io/dbt_netsuite/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fivetran.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-24T21:17:02.000Z","updated_at":"2025-03-23T22:17:57.000Z","dependencies_parsed_at":"2023-10-02T20:40:25.384Z","dependency_job_id":"a52b33d7-1aa9-4131-b41b-199d4d745f35","html_url":"https://github.com/fivetran/dbt_netsuite","commit_stats":{"total_commits":346,"total_committers":22,"mean_commits":"15.727272727272727","dds":0.6791907514450868,"last_synced_commit":"19261a9274ca8a6b5e1fabd7e5083e417422b857"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_netsuite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_netsuite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_netsuite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_netsuite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fivetran","download_url":"https://codeload.github.com/fivetran/dbt_netsuite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247635260,"owners_count":20970705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbt","dbt-packages","fivetran","fivetran-finance-reporting","netsuite"],"created_at":"2024-12-12T03:18:48.454Z","updated_at":"2025-04-07T10:29:25.946Z","avatar_url":"https://github.com/fivetran.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Netsuite Transformation dbt Package ([Docs](https://fivetran.github.io/dbt_netsuite/))\n\n\u003cp align=\"left\"\u003e\n    \u003ca alt=\"License\"\n        href=\"https://github.com/fivetran/dbt_netsuite/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"dbt-core\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/dbt_Core™_version-\u003e=1.3.0_,\u003c2.0.0-orange.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"Maintained?\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"PRs\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contributions-welcome-blueviolet\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"Fivetran Quickstart Compatible\"\n        href=\"https://fivetran.com/docs/transformations/dbt/quickstart\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Fivetran_Quickstart_Compatible%3F-yes-green.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## What does this dbt package do?\n- Produces modeled tables that leverage Netsuite data from [Fivetran's connector](https://fivetran.com/docs/applications/netsuite) in the format described by [this ERD](https://fivetran.com/docs/applications/netsuite#schemainformation) and builds off the output of our [Netsuite source package](https://github.com/fivetran/dbt_netsuite_source).\n- Enables users to insights into their netsuite data that can be used for financial statement reporting and deeper transactional analysis. This is achieved by the following:\n    - Recreating both the balance sheet and income statement\n    - Recreating commonly used data by using the transaction lines as the base table and joining other data\n- Generates a comprehensive data dictionary of your source and modeled Netsuite data through the [dbt docs site](https://fivetran.github.io/dbt_netsuite/).\n\n\u003c!--section=\"netsuite_transformation_model\"--\u003e\nThe following table provides a detailed list of all tables materialized within this package by default.\n\u003e TIP: See more details about these tables in the package's [dbt docs site](https://fivetran.github.io/dbt_netsuite/#!/overview?g_v=1\u0026g_e=seeds).\n\n| **Table**                | **Description**                                                                                                                                |\n| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| [netsuite__transaction_details](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite__transaction_details) or [netsuite2__transaction_details](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__transaction_details)             | All transactions with the associated accounting period, account and subsidiary information. Where applicable, you can also see data about the customer, location, item, vendor, and department. |\n| [netsuite__income_statement](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite__income_statement) or [netsuite2__income_statement](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__income_statement)             | All transaction lines necessary to generate an income statement (converted for the appropriate exchange rate of the parent subsidiary). Department, class, and location information are included for additional reporting functionality. |\n| [netsuite__balance_sheet](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite__balance_sheet) or [netsuite2__balance_sheet](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__balance_sheet)            | All transaction lines necessary to generate a balance sheet (converted for the appropriate exchange rate of the parent subsidiary). Non balance sheet transactions are categorized as either Retained Earnings or Net Income. |\n\nMany of the above reports are now configurable for [visualization via Streamlit](https://github.com/fivetran/streamlit_netsuite)! Check out some [sample reports here](https://fivetran-netsuite.streamlit.app/).\n### Materialized Models\nEach Quickstart transformation job run materializes 88 models if all components of this data model are enabled. This count includes all staging, intermediate, and final models materialized as `view`, `table`, or `incremental`.\n\u003c!--section-end--\u003e\n\n\n## How do I use the dbt package?\n### Step 1: Prerequisites\nTo use this dbt package, you must have At least either one Fivetran **Netsuite** (netsuite.com) or **Netsuite2** (netsuite2) connection syncing the respective tables to your destination:\n#### Netsuite.com\n- accounts\n- accounting_periods\n- accounting_books\n- consolidated_exchange_rates\n- currencies\n- customers\n- classes\n- departments\n- expense_accounts\n- income_accounts\n- items\n- locations\n- partners\n- transaction_lines\n- transactions\n- subsidiaries\n- vendors\n- vendor_types\n\n#### Netsuite2\n- account\n- accounttype\n- accountingbooksubsidiary\n- accountingperiodfiscalcalendar\n- accountingperiod\n- accountingbook\n- consolidatedexchangerate\n- currency\n- customer\n- classification\n- department\n- entity\n- entityaddress\n- item\n- job\n- location\n- locationmainaddress\n- transactionaccountingline\n- transactionline\n- transaction\n- subsidiary\n- vendor\n- vendorcategory\n\n#### Database Compatibility\nThis package is compatible with either a **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination.\n\n#### Databricks dispatch configuration\nIf you are using a Databricks destination with this package, you must add the following (or a variation of the following) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively.\n```yml\ndispatch:\n  - macro_namespace: dbt_utils\n    search_order: ['spark_utils', 'dbt_utils']\n```\nDo **NOT** include the `netsuite_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.\n\n### Step 2: Install the package\nInclude the following netsuite package version in your `packages.yml` file:\n\u003e TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages.\n```yaml\npackages:\n  - package: fivetran/netsuite\n    version: [\"\u003e=0.18.0\", \"\u003c0.19.0\"]\n    \n```\n### Step 3: Define Netsuite.com or Netsuite2 Source\nAs of April 2022 Fivetran released a new Netsuite connector version 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.\n```yml\nvars:\n    netsuite_data_model: netsuite2 #netsuite by default\n```\n\n### Step 4: Define database and schema variables\nBy default, this package runs using your destination and the `netsuite` schema. If this is not where your Netsuite data is (for example, if your netsuite schema is named `netsuite_fivetran`), add the following configuration to your root `dbt_project.yml` file:\n\n```yml\nvars:\n    netsuite_database: your_destination_name\n    netsuite_schema: your_schema_name \n```\n\n### Step 5: Disable models for non-existent sources (Netsuite2 only)\nYour Netsuite connection may not sync every table that this package expects. If your syncs exclude certain tables, it is because you either don't use that feature in Netsuite or actively excluded some tables from your syncs. To disable the corresponding functionality in the package, you must add the relevant variables. By default, all variables are assumed to be true. Add variables for only the tables you would like to disable:\n```yml\nvars:\n    netsuite2__multibook_accounting_enabled: true # False by default. Disable `accountingbooksubsidiary` and `accountingbook` if you are not using the Multi-Book Accounting feature\n    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, ensure it is scoped globally so that the `netsuite_source` package can access it as well.\n    netsuite2__using_vendor_categories: false # True by default. Disable `vendorcategory` if you don't categorize your vendors\n    netsuite2__using_jobs: false # True by default. Disable `job` if you don't use jobs\n    netsuite2__using_employees: false # True by default. Disable `employee` if you don't use employees.\n```\n\u003e **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`) and the `vendorcategory` and `job` source tables. 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.\n\u003e\n\u003e 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).\n\n### (Optional) Step 6: Additional configurations\n\n#### Enable additional features\n\n#### Multi-Book (Netsuite2 only)\nTo include `accounting_book_id` and `accounting_book_name` columns in the end models, set the below variable to `true` in your `dbt_project.yml`. This feature is disabled by default.\n\n\u003eNotes:\n\u003e - If you choose to enable this feature, this will add rows for transactions for any non-primary `accounting_book_id`, and your downstream use cases may need to be adjusted.\n\u003e - The surrogate keys for the end models are dynamically generated depending on the enabled/disabled features, so adding these rows will not cause test failures.\n\u003e - If you are leveraging a `*_pass_through_columns` variable to include the added columns, you may need to remove them to avoid a duplicate column error.\n```yml\nvars:\n    netsuite2__multibook_accounting_enabled: true # False by default.\n```\n\n**IMPORTANT**: If you are using multi-book accounting, this variable must be set to true, or you will see test failures in your data. \n\n#### To Subsidiary (Netsuite2 only)\nTo include `to_subsidiary_id` and `to_subsidiary_name` columns in the end models, set the below variable to `true` in your `dbt_project.yml`. This feature is disabled by default. You will also need to be using exchange rates, which is enabled by default.\n\n\u003eNotes:\n\u003e - If you choose to enable this feature, this will add rows for transactions where `to_subsidiary` is not a top-level subsidiary. Your downstream use cases may need to be adjusted.\n\u003e - The surrogate keys for the end models are dynamically generated depending on the enabled/disabled features, so adding these rows will not cause test failures.\n\u003e - If you are leveraging a `*_pass_through_columns` variable to include the added columns, you may need to remove them to avoid a duplicate column error.\n\n```yml\nvars:\n    netsuite2__using_to_subsidiary: true # False by default.\n```\n\n#### Passing Through Additional Fields\nThis package includes all source columns defined in the macros folder. To add additional columns to this package, do so by adding our pass-through column variables to your `dbt_project.yml` file:\n\n```yml\nvars:\n    accounts_pass_through_columns: \n        - name: \"new_custom_field\"\n          alias: \"custom_field\"\n    classes_pass_through_columns: \n        - name: \"this_field\"\n    departments_pass_through_columns: \n        - name: \"unique_string_field\"\n          alias: \"field_id\"\n          transform_sql: \"cast(field_id as string)\"\n    transactions_pass_through_columns: \n        - name: \"that_field\"\n    transaction_lines_pass_through_columns: \n        - name: \"other_id\"\n          alias: \"another_id\"\n          transform_sql: \"cast(another_id as int64)\"\n    customers_pass_through_columns: \n        - name: \"customer_custom_field\"\n          alias: \"customer_field\"\n    locations_pass_through_columns: \n        - name: \"location_custom_field\"\n    subsidiaries_pass_through_columns: \n        - name: \"sub_field\"\n          alias: \"subsidiary_field\"\n    consolidated_exchange_rates_pass_through_columns: \n        - name: \"consolidate_this_field\"\n```\n\n#### Passing Through Transaction Detail Fields\nAdditionally, this package allows users to pass columns from the `netsuite__transaction_details` table into\nthe `netsuite__balance_sheet` and `netsuite__income_statement` tables. See below for an example\nof how to passthrough transaction detail columns into the respective balance sheet and income statement final tables\nwithin your `dbt_project.yml` file.\n\n```yml\nvars:\n    balance_sheet_transaction_detail_columns: ['company_name','vendor_name']\n    income_statement_transaction_detail_columns: ['is_account_intercompany','location_name']\n```\n\n#### Change the build schema\nBy default, this package builds the Netsuite staging models within a schema titled (`\u003ctarget_schema\u003e` + `_netsuite_source`) and your Netsuite modeling models within a schema titled (`\u003ctarget_schema\u003e` + `_netsuite`) in your destination. If this is not where you would like your Netsuite data to be written to, add the following configuration to your root `dbt_project.yml` file:\n\n```yml\nmodels:\n    netsuite_source:\n      +schema: my_new_schema_name # leave blank for just the target_schema\n    netsuite:\n      +schema: my_new_schema_name # leave blank for just the target_schema\n```\n    \n#### Change the source table references\nIf an individual source table has a different name than the package expects, add the table name as it appears in your destination to the respective variable:\n\n\u003e IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_netsuite_source/blob/main/dbt_project.yml) variable declarations to see the expected names.\n\n```yml\nvars:\n    # For all Netsuite source tables\n    netsuite_\u003cdefault_source_table_name\u003e_identifier: your_table_name \n\n    # For all Netsuite2 source tables\n    netsuite2_\u003cdefault_source_table_name\u003e_identifier: your_table_name \n```\n\n#### Override the data models variable\nThis package is designed to run **either** the Netsuite.com or Netsuite2 data models. However, for documentation purposes, an additional variable `netsuite_data_model_override` was created to allow for both data model types to be run at the same time by setting the variable value to `netsuite`. This is only to ensure the [dbt docs](https://fivetran.github.io/dbt_netsuite/) (which is hosted on this repository) is generated for both model types. While this variable is provided, we recommend you do not adjust the variable and instead change the `netsuite_data_model` variable to fit your configuration needs.\n\n#### Lookback Window\nRecords from the source can sometimes arrive late. Since several of the models in this package are incremental, by default we look back 3 days from the `_fivetran_synced_date` of transaction records to ensure late arrivals are captured and avoiding the need for frequent full refreshes. While the frequency can be reduced, we still recommend running `dbt --full-refresh` periodically to maintain data quality of the models.\n\nTo change the default lookback window, add the following variable to your `dbt_project.yml` file:\n\n```yml\nvars:\n  netsuite:\n    lookback_window: number_of_days # default is 3\n```\n\n#### Adding incremental materialization for Bigquery and Databricks\nSince pricing and runtime priorities vary by customer, by default we chose to materialize the below models as tables instead of an incremental materialization for Bigquery and Databricks. For more information on this decision, see the [Incremental Strategy section](https://github.com/fivetran/dbt_netsuite/blob/main/DECISIONLOG.md#incremental-strategy) of the DECISIONLOG.\n\nIf you wish to enable incremental materializations leveraging the `merge` strategy, you can add the below materialization settings to your `dbt_project.yml` file. You only need to add lines for the specific model materializations you wish to change.\n```yml\nmodels:\n  netsuite:\n    netsuite2:\n      netsuite2__income_statement:\n        +materialized: incremental # default is table for Bigquery and Databricks\n      netsuite2__transaction_details:\n        +materialized: incremental # default is table for Bigquery and Databricks\n      netsuite2__balance_sheet:\n        +materialized: incremental # default is table for Bigquery and Databricks\n```\n\n### (Optional) Step 7: Produce Analytics-Ready Reports with Streamlit App (Bigquery and Snowflake users only)\nFor those who want to take their reports a step further, our team has created the [Fivetran Netsuite Streamlit App](https://fivetran-netsuite.streamlit.app/) to generate end model visualizations based off of the reports we created in this package.  This way you can replicate much of the reporting you see internally in Netsuite and automate a lot of the work needed to report on your core metrics.\n\n[We recommend following the instructions here](https://github.com/fivetran/streamlit_netsuite) to fork the app for your own data and create end reports leveraging our Netsuite models. You can see a sample version of [these reports here](https://fivetran-netsuite.streamlit.app/).\n\n### (Optional) Step 8: Orchestrate your models with Fivetran Transformations for dbt Core™\n\u003cdetails\u003e\u003csummary\u003eExpand for details\u003c/summary\u003e\n\u003cbr\u003e\n\nFivetran offers the ability for you to orchestrate your dbt project through [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt). Learn how to set up your project for orchestration through Fivetran in our [Transformations for dbt Core setup guides](https://fivetran.com/docs/transformations/dbt#setupguide).\n\n\u003c/details\u003e\n\n## Does this package have dependencies?\nThis dbt package is dependent on the following dbt packages. These dependencies are installed by default within this package. For more information on the following packages, refer to the [dbt hub](https://hub.getdbt.com/) site.\n\u003e IMPORTANT: If you have any of these dependent packages in your own `packages.yml` file, we highly recommend that you remove them from your root `packages.yml` to avoid package version conflicts.\n    \n```yml\npackages:\n    - package: fivetran/netsuite_source\n      version: [\"\u003e=0.11.0\", \"\u003c0.12.0\"]\n\n    - package: fivetran/fivetran_utils\n      version: [\"\u003e=0.4.0\", \"\u003c0.5.0\"]\n\n    - package: dbt-labs/dbt_utils\n      version: [\"\u003e=1.0.0\", \"\u003c2.0.0\"]\n\n    - package: dbt-labs/spark_utils\n      version: [\"\u003e=0.3.0\", \"\u003c0.4.0\"]\n```\n## How is this package maintained and can I contribute?\n### Package Maintenance\nThe Fivetran team maintaining this package _only_ maintains the latest version of the package. We highly recommend you stay consistent with the [latest version](https://hub.getdbt.com/fivetran/netsuite/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_netsuite/blob/main/CHANGELOG.md) and release notes for more information on changes across versions.\n\n### Contributions\nA small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions.\n\nWe highly encourage and welcome contributions to this package. Check out [this dbt Discourse article](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package.\n\n## Are there any resources available?\n- If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_netsuite/issues/new/choose) section to find the right avenue of support for you.\n- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fdbt_netsuite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffivetran%2Fdbt_netsuite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fdbt_netsuite/lists"}