|
| 1 | +[](https://opensource.org/licenses/Apache-2.0)  |
| 2 | +# Pendo (Source) |
| 3 | + |
| 4 | +This package models Pendo data from [Fivetran's connector](https://fivetran.com/docs/applications/pendo). It uses data in the format described by [this ERD](https://fivetran.com/docs/applications/pendo#schemainformation). |
| 5 | + |
| 6 | +This package enriches your Fivetran data by doing the following: |
| 7 | +* Adds descriptions to tables and columns that are synced using Fivetran |
| 8 | +* Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. |
| 9 | +* Models staging tables, which will be used in our transform package |
| 10 | + |
| 11 | +## Models |
| 12 | + |
| 13 | +This package contains staging models, designed to work simultaneously with our [Pendo modeling package](https://github.com/fivetran/dbt_pendo). The staging models: |
| 14 | +* Remove any rows that are soft-deleted |
| 15 | +* Name columns consistently across all packages: |
| 16 | + * Boolean fields are prefixed with `is_` or `has_` |
| 17 | + * Timestamps are appended with `_at` |
| 18 | + * ID primary keys are prefixed with the name of the table. For example, a user table's ID column is renamed `user_id` |
| 19 | + |
| 20 | +## Installation Instructions |
| 21 | +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. |
| 22 | + |
| 23 | +## Configuration |
| 24 | + |
| 25 | +By default, this package looks for your Pendo data in the `pendo` schema of your [target database](https://docs.getdbt.com/docs/running-a-dbt-project/using-the-command-line-interface/configure-your-profile). If this is not where your Pendo data is, add the following configuration to your `dbt_project.yml` file: |
| 26 | + |
| 27 | +```yml |
| 28 | +# dbt_project.yml |
| 29 | + |
| 30 | +... |
| 31 | +config-version: 2 |
| 32 | + |
| 33 | +vars: |
| 34 | + pendo_database: your_database_name |
| 35 | + pendo_schema: your_schema_name |
| 36 | +``` |
| 37 | +
|
| 38 | +### Passthrough Columns |
| 39 | +
|
| 40 | +This package includes all of the source columns that are defined in the macros folder. We recommend including custom columns in this package because the staging models only bring in the standard columns for the `EVENT`, `FEATURE_EVENT`, `PAGE_EVENT`, `ACCOUNT_HISTORY`, and `VISITOR_HISTORY` tables. |
| 41 | + |
| 42 | +You can add more columns using our passthrough column variables. These variables allow the passthrough columns to be aliased (`alias`) and casted (`transform_sql`) if you want, although it is not required. You can configure datatype casting by using a SQL snippet within the `transform_sql` key. You may add the desired SQL snippet while omitting the `as field_name` part of the casting statement - we rename this column with the alias attribute - and your custom passthrough columns will be casted accordingly. |
| 43 | + |
| 44 | +Use the following format for declaring the respective passthrough variables: |
| 45 | + |
| 46 | +```yml |
| 47 | +# dbt_project.yml |
| 48 | +
|
| 49 | +vars: |
| 50 | +
|
| 51 | + pendo__feature_event_pass_through_columns: |
| 52 | + - name: "custom_crazy_field_name" |
| 53 | + alias: "normal_field_name" |
| 54 | + pendo__page_event_pass_through_columns: |
| 55 | + - name: "property_field_id" |
| 56 | + alias: "new_name_for_this_field_id" |
| 57 | + transform_sql: "cast(new_name_for_this_field as int64)" |
| 58 | + - name: "this_other_field" |
| 59 | + transform_sql: "cast(this_other_field as string)" |
| 60 | + pendo__event_pass_through_columns: |
| 61 | + - name: "well_named_field_1" |
| 62 | + pendo__account_history_pass_through_columns: |
| 63 | + - name: "well_named_field_2" |
| 64 | + pendo__visitor_history_pass_through_columns: |
| 65 | + - name: "well_named_field_3" |
| 66 | +``` |
| 67 | + |
| 68 | +### Changing the Build Schema |
| 69 | + |
| 70 | +By default, this package builds the Pendo staging models within a schema titled (`<target_schema>` + `_stg_pendo`) in your target database. If this is not where you would like your Pendo staging data to be written to, add the following configuration to your `dbt_project.yml` file: |
| 71 | + |
| 72 | +```yml |
| 73 | +# dbt_project.yml |
| 74 | +
|
| 75 | +... |
| 76 | +models: |
| 77 | + pendo_source: |
| 78 | + +schema: my_new_schema_name # leave blank for just the target_schema |
| 79 | +``` |
| 80 | + |
| 81 | +> Note that if your profile does not have permissions to create schemas in your warehouse, you can set the `+schema` to blank. The package will then write all tables to your pre-existing target schema. |
| 82 | + |
| 83 | +## Contributions |
| 84 | + |
| 85 | +Don't see a model or specific metric you would have liked to be included? Notice any bugs when installing |
| 86 | +and running the package? If so, we highly encourage and welcome contributions to this package! |
| 87 | +Please create issues or open PRs against `master`. Check out [this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package. |
| 88 | + |
| 89 | +## Database Support |
| 90 | + |
| 91 | +This package has been tested on BigQuery, Snowflake, Redshift, Postgres, and Databricks. |
| 92 | + |
| 93 | +## Resources: |
| 94 | +- Provide [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next |
| 95 | +- Have questions, feedback, or need help? Book a time during our office hours [using Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at solutions@fivetran.com |
| 96 | +- Find all of Fivetran's pre-built dbt packages in our [dbt hub](https://hub.getdbt.com/fivetran/) |
| 97 | +- Learn how to orchestrate [dbt transformations with Fivetran](https://fivetran.com/docs/transformations/dbt) |
| 98 | +- Learn more about Fivetran overall [in our docs](https://fivetran.com/docs) |
| 99 | +- Check out [Fivetran's blog](https://fivetran.com/blog) |
| 100 | +- Learn more about dbt [in the dbt docs](https://docs.getdbt.com/docs/introduction) |
| 101 | +- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers |
| 102 | +- Join the [chat](http://slack.getdbt.com/) on Slack for live discussions and support |
| 103 | +- Find [dbt events](https://events.getdbt.com) near you |
| 104 | +- Check out [the dbt blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices |
0 commit comments