diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 17c2c54..38c56bc 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,7 +1,7 @@ name: 🐞 Bug description: Report a bug or an issue you've found within the dbt package title: "[Bug] " -labels: ["bug", "triage"] +labels: ["type:bug"] body: - type: markdown attributes: @@ -35,6 +35,12 @@ body: description: A concise description of what you expected to happen. validations: required: true + - type: textarea + attributes: + label: Possible solution + description: Were you able to investigate and/or discover a potential fix to this bug in your investigation? If so, it would be much appreciated if you could submit code samples to show us how your fix resolved this issue. + validations: + required: false - type: textarea attributes: label: dbt Project configurations @@ -61,6 +67,19 @@ body: - other (mention it in "Additional Context") validations: required: true + - type: dropdown + id: orchestration_type + attributes: + label: How are you running this dbt package? + multiple: true + options: + - Fivetran Quickstart Data Model + - Fivetran Transformations + - dbt Core™ + - dbt Cloud™ + - other (mention it in "Additional Context") + validations: + required: true - type: textarea attributes: label: dbt Version @@ -83,6 +102,6 @@ body: description: Our team will assess this issue and let you know if we will add it to a future sprint. However, if you would like to expedite the solution, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. options: - label: Yes. - - label: Yes, but I will need assistance and will schedule time during our [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance + - label: Yes, but I will need assistance. - label: No. required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 6fa36f8..496b3bd 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ contact_links: - - name: Provide feedback or request a new package to our dbt package team + - name: Provide feedback to our dbt package team url: https://www.surveymonkey.com/r/DQ7K7WW about: Fill out our survey form to provide valuable feedback to the Fivetran team developing and maintaining the dbt packages. - name: Fivetran connector question diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index a1d28bb..529e9bc 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -1,7 +1,7 @@ name: 🎉 Feature description: Suggest a new feature for the Fivetran dbt package title: "[Feature] <title>" -labels: ["enhancement"] +labels: ["type:enhancement"] body: - type: markdown attributes: @@ -20,6 +20,13 @@ body: description: A clear and concise description of what you want to happen and why you want the new feature. validations: required: true + - type: textarea + attributes: + label: How would you implement this feature? + description: | + How would you build out this feature with your existing data? Any code examples you can provide to help accelerate development on this issue? + validations: + required: true - type: textarea attributes: label: Describe alternatives you've considered @@ -34,7 +41,7 @@ body: description: Our team will assess this feature and let you know if we will add it to a future sprint. However, if you would like to expedite the feature, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. options: - label: Yes. - - label: Yes, but I will need assistance and will schedule time during your [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance. + - label: Yes, but I will need assistance. - label: No. required: false - type: textarea diff --git a/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md index 1e22b09..3220674 100644 --- a/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md @@ -16,7 +16,6 @@ Please acknowledge that you have successfully performed the following commands l 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 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b4e7e8e..30849fd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -19,7 +19,13 @@ <!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> - [ ] Yes -**Provide an emoji that best describes your current mood** +**Typically there are additional maintenance changes required before this will be ready for an upcoming release. Are you comfortable with the Fivetran team making a few commits directly to your branch?** +<!--- If you select Yes this will help expedite your PR in case there are small changes required before approval. We encourage you not to use this branch in a production environment as we may make additional updates. --> +<!--- If you select No, we will not make any changes directly to your branch and will either communicate any planned changes via the PR thread or will merge your PR into a separate branch so we may make changes without modifying your branch.. --> +- [ ] Yes +- [ ] No + +**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: diff --git a/README.md b/README.md index 5d30bde..5d439c1 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ <img src="https://img.shields.io/badge/Fivetran_Quickstart_Compatible%3F-yes-green.svg" /></a> </p> -# Salesforce Source dbt Package ([Docs](https://fivetran.github.io/dbt_salesforce_source/)) -# 📣 What does this dbt package do? +# Salesforce Source dbt Package ([Docs](https://fivetran.github.io/dbt_salesforce_source/)) +## What does this dbt package do? <!--section="salesforce_source_model"--> - Cleans, tests, and prepares your Salesforce data from [Fivetran's connector](https://fivetran.com/docs/applications/salesforce) for analysis. - Generates a comprehensive data dictionary of your Salesforce data via the [dbt docs site](https://fivetran.github.io/dbt_salesforce_source/) @@ -23,12 +23,12 @@ - Optional: You can also bring in Salesforce history mode models utilizing [Fivetran's History Mode](https://fivetran.com/docs/core-concepts/sync-modes/history-mode). <!--section-end--> -# 🎯 How do I use the dbt package? -## Step 1: Pre-Requisites -- **Connector**: Have the Fivetran Salesforce connector syncing data into your warehouse. +## How do I use the dbt package? +### Step 1: Pre-Requisites +- **Connector**: Have the Fivetran Salesforce connector syncing data into your warehouse. - **Database support**: This package has been tested on **Postgres**, **Databricks**, **Redshift**, **Snowflake**, and **BigQuery**. -### Databricks Dispatch Configuration +#### Databricks Dispatch Configuration If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) 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. ```yml dispatch: @@ -36,15 +36,15 @@ dispatch: search_order: ['spark_utils', 'dbt_utils'] ``` -### Database Incremental Strategies +#### Database Incremental Strategies The history models in this package are materialized incrementally. We have chosen `insert_overwrite` as the default strategy for **BigQuery** and **Databricks** databases, as it is only available for these dbt adapters. For **Snowflake**, **Redshift**, and **Postgres** databases, we have chosen `delete+insert` as the default strategy. `insert_overwrite` is our preferred incremental strategy because it will be able to properly handle updates to records that exist outside the immediate incremental window. That is, because it leverages partitions, `insert_overwrite` will appropriately update existing rows that have been changed upstream instead of inserting duplicates of them--all without requiring a full table scan. -`delete+insert` is our second-choice as it resembles `insert_overwrite` but lacks partitions. This strategy works most of the time and appropriately handles incremental loads that do not contain changes to past records. However, if a past record has been updated and is outside of the incremental window, `delete+insert` will insert a duplicate record. 😱 +`delete+insert` is our second-choice as it resembles `insert_overwrite` but lacks partitions. This strategy works most of the time and appropriately handles incremental loads that do not contain changes to past records. However, if a past record has been updated and is outside of the incremental window, `delete+insert` will insert a duplicate record. > Because of this, we highly recommend that **Snowflake**, **Redshift**, and **Postgres** users periodically run a `--full-refresh` to ensure a high level of data quality and remove any possible duplicates. -## Step 2: Installing the Package (skip if also using the `salesforce` transformation package) +### Step 2: Installing the Package (skip if also using the `salesforce` transformation package) If you are **not** using the [Salesforce transformation package](https://github.com/fivetran/dbt_salesforce), include the following `salesforce_source` package version in your `packages.yml` > 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. @@ -53,8 +53,8 @@ packages: - package: fivetran/salesforce_source version: [">=1.1.0", "<1.2.0"] # we recommend using ranges to capture non-breaking changes automatically ``` -## Step 3: Configure Your Variables -### Database and Schema Variables (Using the standard Salesforce schema only) +### Step 3: Configure Your Variables +#### Database and Schema Variables (Using the standard Salesforce schema only) By default, this package will run using your target database and the `salesforce` schema. If this is not where your Salesforce data is (perhaps your Salesforce schema is `salesforce_fivetran`), add the following configuration to your root `dbt_project.yml` file: ```yml @@ -63,8 +63,8 @@ vars: salesforce_schema: your_schema_name ``` -### Disabling Models -It is possible that your Salesforce connector does not sync every table that this package expects. If your syncs exclude certain tables, it is because you either don't use that functionality in Salesforce or actively excluded some tables from your syncs. +#### Disabling Models +It is possible that your Salesforce connector does not sync every table that this package expects. If your syncs exclude certain tables, it is because you either don't use that functionality in Salesforce or actively excluded some tables from your syncs. To disable the corresponding functionality in this package, you must add the corresponding variable(s) to your `dbt_project.yml`, which are listed below. By default, that is if none of these variables are added, all variables are assumed to be true. Add variables only for the tables you would like to disable: @@ -80,13 +80,13 @@ vars: ``` The corresponding metrics from the disabled tables will not populate in the downstream models. -## (Optional) Step 4: Utilizing Salesforce History Mode records +### (Optional) Step 4: Utilizing Salesforce History Mode records If you have Salesforce [History Mode](https://fivetran.com/docs/using-fivetran/features#historymode) enabled for your connector, we now include support for the `account`, `contact`, and `opportunity` tables directly. This will allow you access to your historical data for these tables while taking advantage of incremental loads to help with compute. -### Configuring Your Salesforce History Mode Database and Schema Variables +#### Configuring Your Salesforce History Mode Database and Schema Variables Customers leveraging the Salesforce connector generally fall into one of two categories when taking advantage of History mode. They either have one connector that is syncing non-historical records and a separate connector that syncs historical records, **or** they have one connector that is syncing historical records. We have designed this feature to support both scenarios. -#### Option 1: Two connectors, one with non-historical data and another with historical data +##### Option 1: Two connectors, one with non-historical data and another with historical data If you are gathering data from both standard Salesforce as well as Salesforce History Mode, and your target database and schema differ as well, you will need to add an additional configuration for the history schema and database to your `dbt_project.yml`. ```yml @@ -98,7 +98,7 @@ vars: salesforce_history_schema: your_history_schema_name ``` -#### Option 2: One connector being used to sync historical data +##### Option 2: One connector being used to sync historical data Perhaps you may only want to use the Salesforce History Mode to bring in your data. Because the Salesforce schema is pointing to the default `salesforce` schema and database, you will want to add the following variable into your `dbt_project.yml` to point it to the `salesforce_history` equivalents. ```yml @@ -110,9 +110,9 @@ vars: salesforce_history_schema: your_history_schema_name ``` -**IMPORTANT**: If you utilize Option 2 and are also using the `dbt_salesforce` package, you must sync the equivalent enabled tables and fields in your history mode connector that are being brought into your end reports. Examine your data lineage and the model fields within the `salesforce` folder to see which tables and fields you are using and need to bring in and sync in the history mode connector. +**IMPORTANT**: If you utilize Option 2 and are also using the `dbt_salesforce` package, you must sync the equivalent enabled tables and fields in your history mode connector that are being brought into your end reports. Examine your data lineage and the model fields within the `salesforce` folder to see which tables and fields you are using and need to bring in and sync in the history mode connector. -### Enabling Salesforce History Mode Models +#### Enabling Salesforce History Mode Models The History Mode models can get quite expansive since it will take in **ALL** historical records, so we've disabled them by default. You can enable the history models you'd like to utilize by adding the below variable configurations within your `dbt_project.yml` file for the equivalent models. ```yml @@ -128,7 +128,7 @@ vars: Daily account, contact and opportunity history tables that are created from these history tables are available [in our `dbt_salesforce` package](https://github.com/fivetran/dbt_salesforce/blob/main/README.md#-what-does-this-dbt-package-do). -### Filter your Salesforce History Mode models with field variable conditionals +#### Filter your Salesforce History Mode models with field variable conditionals By default, these models are set to bring in all your data from Salesforce History, but you may be interested in bringing in only a smaller sample of historical records, given the relative size of the Salesforce History source tables. We have set up where conditions in our staging models to allow you to bring in only the data you need to run in. You can set a global history filter that would apply to all of our staging history models in your `dbt_project.yml`: @@ -148,18 +148,18 @@ vars: opportunity_history_start_date: 'YYYY-MM-DD' # The first date in opportunity history you wish to pull records from, filtering on `_fivetran_start`. ``` -### IMPORTANT: How To Update Your History Models -To ensure maximum value for these history mode models and avoid messy historical data that could come with picking and choosing which fields you bring in, **all fields in your Salesforce history mode connector are being synced into your end staging models**. That means all custom fields you picked to sync are being brought in to the final models. [See our DECISIONLOG for more details on why we are bringing in all fields](https://github.com/fivetran/dbt_salesforce_source/blob/main/DECISIONLOG.md). +#### IMPORTANT: How To Update Your History Models +To ensure maximum value for these history mode models and avoid messy historical data that could come with picking and choosing which fields you bring in, **all fields in your Salesforce history mode connector are being synced into your end staging models**. That means all custom fields you picked to sync are being brought in to the final models. [See our DECISIONLOG for more details on why we are bringing in all fields](https://github.com/fivetran/dbt_salesforce_source/blob/main/DECISIONLOG.md). -To update the history mode models, you must follow these steps: +To update the history mode models, you must follow these steps: 1) Go to your Fivetran Salesforce History Mode connector page. -2) Update the fields that you are bringing into the model. +2) Update the fields that you are bringing into the model. 3) Run a `dbt run --full-refresh` on the specific staging models you've updated to bring in these fields and all the historical data available with these fields. -We are aware that bringing in additional fields will be very process-heavy, so we do emphasize caution in making changes to your history mode connector. It would be best to batch as many field changes as possible before executing a `--full-refresh` to save on processing. +We are aware that bringing in additional fields will be very process-heavy, so we do emphasize caution in making changes to your history mode connector. It would be best to batch as many field changes as possible before executing a `--full-refresh` to save on processing. -## (Optional) Step 5: Additional Configurations -### Change the Build Schema +### (Optional) Step 5: Additional Configurations +#### Change the Build Schema By default, this package builds the Salesforce staging models within a schema titled (<target_schema> + `_stg_salesforce`) in your target database. If this is not where you would like your Salesforce staging data to be written to, add the following configuration to your root `dbt_project.yml` file: ```yml @@ -168,7 +168,7 @@ models: +schema: my_new_schema_name # leave blank for just the target_schema ``` -### Change the Source Table References +#### Change the Source Table References If an individual source table has a different name than expected, provide the name of the table as it appears in your warehouse to the respective variable: > IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_salesforce_source/blob/main/dbt_project.yml) variable declarations to see the expected names. @@ -180,18 +180,18 @@ vars: salesforce_<default_source_table_name>_identifier: your_table_name ``` -### 🚨 Snowflake Users -If you do **not** use the default all-caps naming conventions for Snowflake, you may need to provide the case-sensitive spelling of your source tables that are also Snowflake reserved words. +#### Snowflake Users +If you do **not** use the default all-caps naming conventions for Snowflake, you may need to provide the case-sensitive spelling of your source tables that are also Snowflake reserved words. In this package, this would apply to the `ORDER` source. If you are receiving errors for this source, include the below identifier in your `dbt_project.yml` file: ```yml vars: - salesforce_order_identifier: "Order" # as an example, must include the double-quotes and correct case! + salesforce_order_identifier: "Order" # as an example, must include the double-quotes and correct case. ``` -### Adding Formula Fields as Pass Through Columns -The source tables Fivetran syncs do not include formula fields. If your company uses them, you can generate them by referring to the [Salesforce Formula Utils](https://github.com/fivetran/dbt_salesforce_formula_utils) package. To pass through the fields, add the [latest version of the package](https://github.com/fivetran/dbt_salesforce_formula_utils#installing-the-macro-package). We recommend confirming your formula field models successfully populate before integrating with the Salesforce package. +#### Adding Formula Fields as Pass Through Columns +The source tables Fivetran syncs do not include formula fields. If your company uses them, you can generate them by referring to the [Salesforce Formula Utils](https://github.com/fivetran/dbt_salesforce_formula_utils) package. To pass through the fields, add the [latest version of the package](https://github.com/fivetran/dbt_salesforce_formula_utils#installing-the-macro-package). We recommend confirming your formula field models successfully populate before integrating with the Salesforce package. Include the following within your `dbt_project.yml` file: ```yml @@ -204,7 +204,7 @@ Include the following within your `dbt_project.yml` file: alias: "opportunity_field_x" ``` -### Adding Passthrough Columns +#### Adding Passthrough Columns This package includes all source columns defined in the `generate_columns.sql` macro. You can add more columns using our passthrough column variables. These variables allow for the passthrough fields to be aliased (`alias`) and casted (`transform_sql`) if desired, but not required. Datatype casting is configured via a sql snippet within the `transform_sql` key. You may add the desired sql while omitting the `as field_name` at the end and your custom pass-though fields will be casted accordingly. Use the below format for declaring the respective pass-through variables: @@ -250,9 +250,9 @@ vars: - name: "salesforce__user_field" ``` -## (Optional) Step 6: Orchestrate your models with Fivetran Transformations for dbt Core™ -Fivetran offers the ability for you to orchestrate your dbt project through the [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt) product. Refer to the linked docs for more information on how to setup your project for orchestration through Fivetran. -# 🔍 Does this package have dependencies? +### (Optional) Step 6: Orchestrate your models with Fivetran Transformations for dbt Core™ +Fivetran offers the ability for you to orchestrate your dbt project through the [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt) product. Refer to the linked docs for more information on how to setup your project for orchestration through Fivetran. +## Does this package have dependencies? This dbt package is dependent on the following dbt packages. For more information on the below packages, refer to the [dbt hub](https://hub.getdbt.com/) site. > **If you have any of these dependent packages in your own `packages.yml` I highly recommend you remove them to ensure there are no package version conflicts.** ```yml @@ -266,16 +266,15 @@ packages: - package: dbt-labs/spark_utils version: [">=0.3.0", "<0.4.0"] ``` -# 🙌 How is this package maintained and can I contribute? -## Package Maintenance +## How is this package maintained and can I contribute? +### Package Maintenance The 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/salesforce_source/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_salesforce_source/blob/main/CHANGELOG.md) and release notes for more information on changes across versions. -## Contributions -These dbt packages are developed by a small team of analytics engineers at Fivetran. However, the packages are made better by community contributions! +### Contributions +These dbt packages are developed by a small team of analytics engineers at Fivetran. However, the packages are made better by community contributions. -We highly encourage and welcome contributions to this package. Check out [this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package! +We highly encourage and welcome contributions to this package. Check out [this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package. -# 🏪 Are there any resources available? -- If you encounter any questions or want to reach out for help, please refer to the [GitHub Issue](https://github.com/fivetran/dbt_salesforce_source/issues/new/choose) section to find the right avenue of support for you. +## Are there any resources available? +- If you encounter any questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_salesforce_source/issues/new/choose) section to find the right avenue of support for you. - If you would like to provide feedback to the dbt package team at Fivetran, or would like to request a future dbt package to be developed, then feel free to fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW). -- Have questions or want to be part of the community discourse? Create a post in the [Fivetran community](https://community.fivetran.com/t5/user-group-for-dbt/gh-p/dbt-user-group) and our team along with the community can join in on the discussion!