This dbt package transforms data from Fivetran's Social Media Reporting connector into analytics-ready tables.
- Number of materialized models¹: 6
- Connector documentation
- dbt package documentation
- dbt Core™ supported versions
>=1.3.0, <3.0.0
This package enables you to aggregate and model data from multiple Fivetran social media connections, standardize schemas from various social media connections, and analyze post performance by clicks, impressions, shares, likes, and comments. It creates enriched models with metrics focused on unified social media reporting across platforms.
Currently, this package supports the following social media connector types:
NOTE: You do not need to have all of these connector types to use this package, though you should have at least two.
Final output tables are generated in the following target schema:
<your_database>.<connector/schema_name>_social_media_reporting
By default, this package materializes the following final tables:
| Table | Description |
|---|---|
| social_media_reporting__rollup_report | Consolidates post performance across multiple social media platforms (Facebook, Instagram, LinkedIn, Twitter, and YouTube Analytics) to compare engagement, reach, and content effectiveness in one unified view. Example Analytics Questions:
|
Each Quickstart transformation job run materializes the following model counts for each selected connector. The total model count represents all staging, intermediate, and final models, materialized as view, table, or incremental:
| Connector | Model Count |
|---|---|
| Social Media Reporting | 6 |
| Facebook Pages | 11 |
| Instagram Business | 7 |
| LinkedIn Company Pages | 23 |
| Twitter Organic | 11 |
| Youtube Analytics | 11 |
¹ Each Quickstart transformation job run materializes these 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.
To use this dbt package, you must have the following:
- At least one Fivetran Social Media Reporting connection syncing data into your destination.
- A BigQuery, Snowflake, Redshift, Postgres, or Databricks destination.
Connector: Have at least one of the below supported Fivetran social media platform connections syncing data into your destination. This package currently supports:
While you need only one of the above connections to utilize this package, we recommend having at least two to gain the rollup benefit of this package.
You can either add this dbt package in the Fivetran dashboard or import it into your dbt project:
- To add the package in the Fivetran dashboard, follow our Quickstart guide.
- To add the package to your dbt project, follow the setup instructions in the dbt package's README file to use this package.
Include the following github package version in your packages.yml
Check dbt Hub for the latest installation instructions, or read the dbt docs for more information on installing packages.
packages:
- package: fivetran/social_media_reporting
version: [">=1.6.0", "<1.7.0"] # we recommend using ranges to capture non-breaking changes automaticallyDo NOT include the upstream social media packages in this file. The transformation package itself has a dependency on it and will install the upstream packages as well.
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.
dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils']By default, this package looks for your social media data in your target database. If this is not where your social media data is stored, add the relevant <connector>_database variables to your dbt_project.yml file (see below).
vars:
##Facebook Pages schema and database variables
facebook_pages_schema: facebook_pages_schema
facebook_pages_database: facebook_pages_database
##Instagram Business schema and database variables
instagram_business_schema: instagram_business_schema
instagram_business_database: instagram_business_database
##LinkedIn Pages schema and database variables
linkedin_pages_schema: linkedin_pages_schema
linkedin_pages_database: linkedin_pages_database
##Twitter Organic schema and database variables
twitter_organic_schema: twitter_organic_schema
twitter_organic_database: twitter_organic_database
##Youtube Analytics schema and database variables
youtube_analytics_schema: youtube_analytics_schema
youtube_analytics_database: youtube_analytics_databaseIf you have multiple social media platform connections of the same type in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. For each source table, the package will union all of the data together and pass the unioned table into the transformations. The source_relation column in each model indicates the origin of each record.
To use this functionality, you will need to set the below variables in your root dbt_project.yml file:
# dbt_project.yml
vars:
facebook_pages_sources:
- database: connection_1_destination_name # Required
schema: connection_1_schema_name # Required
name: connection_1_source_name # Required only if following the step in the following subsection
- database: connection_2_destination_name
schema: connection_2_schema_name
name: connection_2_source_name
instagram_business_sources:
- database: connection_1_destination_name # Required
schema: connection_1_schema_name # Required
name: connection_1_source_name # Required only if following the step in the following subsection
- database: connection_2_destination_name
schema: connection_2_schema_name
name: connection_2_source_name
twitter_organic_sources:
- database: connection_1_destination_name # Required
schema: connection_1_schema_name # Required
name: connection_1_source_name # Required only if following the step in the following subsection
- database: connection_2_destination_name
schema: connection_2_schema_name
name: connection_2_source_name
linkedin_pages_sources:
- database: connection_1_destination_name # Required
schema: connection_1_schema_name # Required
name: connection_1_source_name # Required only if following the step in the following subsection
- database: connection_2_destination_name
schema: connection_2_schema_name
name: connection_2_source_name
youtube_analytics_sources:
- database: connection_1_destination_name # Required
schema: connection_1_schema_name # Required
name: connection_1_source_name # Required only if following the step in the following subsection
- database: connection_2_destination_name
schema: connection_2_schema_name
name: connection_2_source_namePrevious versions of this package employed two separate, mutually exclusive variables for unioning for each platform: (eg.
facebook_pages_union_schemasandfacebook_pages_union_databases). While these variables are still supported, the new approach shared above are the recommended variables to configure.
If you use Fivetran Transformations for dbt Core™ and are unioning multiple social media platform connections of the same type, you can define your sources in a property .yml file. Set the variable has_defined_sources: true in your dbt_project.yml. Otherwise, your connections won't appear in your DAG. See the union_connections macro documentation for full configuration details.
The package assumes that all connector models are enabled, so it will look to pull data from all of the connections listed above. If you don't want to use certain connections, disable those connections' models in this package by setting the relevant variables to false:
vars:
social_media_rollup__twitter_enabled: False
social_media_rollup__facebook_enabled: False
social_media_rollup__linkedin_enabled: False
social_media_rollup__instagram_enabled: False
social_media_rollup__youtube_enabled: FalseNext, you must disable the models in the unwanted connection's related package, which has its own configuration. Disable the relevant models under the models section of your dbt_project.yml file by setting the enabled value to false.
Only include the models you want to disable. Default values are generally true but that is not always the case.
models:
# disable instagram business models if not using instagram business
instagram_business:
+enabled: false
# disable linkedin company pages models if not using linkedin company pages
linkedin_pages:
+enabled: false
# disable twitter organic models if not using twitter organic
twitter_organic:
+enabled: false
# disable facebook pages models if not using facebook pages
facebook_pages:
+enabled: false
# disable youtube analytics models if not using youtube analytics
youtube_analytics:
+enabled: falseIf 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:
IMPORTANT: See the Facebook Pages
dbt_project.yml, Instagram Businessdbt_project.yml, LinkedIn Company Pagesdbt_project.yml, Twitter Organicdbt_project.yml, and Youtube Analyticsdbt_project.ymlvariable declarations to see the expected names.
vars:
<default_source_table_name>_identifier: your_table_name By default, the package applies case-insensitive comparisons when resolving source_relation values. If your destination is case-sensitive and you want downstream transformations to respect the exact casing of your source database and schema names, set the following variable:
vars:
fivetran_using_source_casing: trueThis 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 site.
IMPORTANT: If you have any of these dependent packages in your own
packages.ymlfile, we highly recommend that you remove them from your rootpackages.ymlto avoid package version conflicts.
packages:
- package: fivetran/facebook_pages
version: [">=1.3.0", "<1.4.0"]
- package: fivetran/instagram_business
version: [">=1.2.0", "<1.3.0"]
- package: fivetran/twitter_organic
version: [">=1.2.0", "<1.3.0"]
- package: fivetran/linkedin_pages
version: [">=1.4.0", "<1.5.0"]
- package: fivetran/youtube_analytics
version: [">=1.2.0", "<1.3.0"]
- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
- package: dbt-labs/dbt_utils
version: [">=1.0.0", "<2.0.0"]
- package: dbt-labs/spark_utils
version: [">=0.3.0", "<0.4.0"]The Fivetran team maintaining this package only maintains the latest version of the package. We highly recommend you stay consistent with the latest version of the package and refer to the CHANGELOG and release notes for more information on changes across versions.
A small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions.
We highly encourage and welcome contributions to this package. Learn how to contribute to a package in dbt's Contributing to an external dbt package article.
- If you encounter any questions or want to reach out for help, see the GitHub Issue 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.