Giter VIP home page Giter VIP logo

crowdpiper_dbt_social_media_reporting's Introduction

Social Media Reporting

This dbt package aggregates and models data from multiple Fivetran social media connectors. The package standardizes the schemas from the various social media connectors and creates a single reporting model for all activity. It enables you to analyze your post performance by clicks, impressions, shares, likes, and comments.

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.

Models

This package contains a number of models, which all build up to the final social_media_reporting model. The social_media_reporting model combines the data from all of the connectors. A dependency on all the required dbt packages is declared in this package's packages.yml file, so it will automatically download them when you run dbt deps. The primary outputs of this package are described below.

model description
social_media_reporting__rollup_report Each record represents a post from a social media account across selected connectors, including post metadata and metrics.

Installation Instructions

Check dbt Hub for the latest installation instructions, or read the dbt docs for more information on installing packages.

Include in your packages.yml

packages:
  - package: fivetran/social_media_reporting
    version: [">=0.2.0", "<0.3.0"]

Package Maintenance

The Fivetran team maintaining this package only maintains the latest version. We highly recommend that you keep your packages.yml file updated with the latest version in the dbt hub. Read the CHANGELOG and release notes for more information on changes across versions.

Configuration

Connector selection

The package assumes that all connector models are enabled, so it will look to pull data from all of the connectors listed above. If you don't want to use certain connectors, disable those connectors' models in this package by setting the relevant variables to false:

# dbt_project.yml

...
config-version: 2

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

Next, you must disable the models in the unwanted connector'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 both instagram business models if not using instagram business
    instagram_business:
        enabled: false
    instagram_business_source:
        enabled: false
  
    # disable both linkedin company pages models if not using linkedin company pages
    linkedin_pages:
        enabled: false
    linkedin_pages_source:
        enabled: false
  
    # disable both twitter organic models if not using twitter organic
    twitter_organic:
        enabled: false
    twitter_organic_source:
        enabled: false
    
    # disable all three facebook pages models if not using facebook pages
    facebook_pages:
        enabled: false
    facebook_pages_source:
        enabled: false

Data Location

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 _database variables to your dbt_project.yml file (see below).

By default, this package also looks for specific schemas from each of your connectors. The schemas from each connector are highlighted in the code snippet below. If your data is stored in a different schema, add the relevant _schema variables to your dbt_project.yml file:

# dbt_project.yml

...
config-version: 2

vars:
    ##Facebook Pages schema and database variables
    facebook_pages_schema: facebook_pages_schema
    facebook_pages_database: facebook_pages_database

    ##LinkedIn Pages schema and database variables
    linkedin_pages_schema: linkedin_pages_schema
    linkedin_pages_database: linkedin_pages_database

    ##Instagram Business schema and database variables
    instagram_business_schema: instagram_business_schema
    instagram_business_database: instagram_business_database

    ##Twitter Organic schema and database variables
    twitter_organic_schema: twitter_organic_schema
    twitter_organic_database: twitter_organic_database

Unioning Multiple Social Media Connectors

If you have multiple social media connectors in Fivetran, you can use this package on all of them simultaneously. The package will union all of the data together and then pass the unioned table(s) into the reporting model. You will be able to see which source the data came from in the source_relation column of each model. To use this functionality, you will need to set either the union_schemas or union_databases variables:

IMPORTANT: You cannot use both the union_schemas and union_databases variables.

# dbt_project.yml
...
config-version: 2
vars:
    ##Schemas variables
    facebook_pages_union_schemas: ['facebook_pages_one','facebook_pages_two']
    linkedin_pages_union_schemas: ['linkedin_company_pages_one', 'linkedin_company_pages_two']
    instagram_business_union_schemas: ['instagram_business_one', 'instagram_business_two', 'instagram_business_three']
    twitter_organic_union_schemas: ['twitter_social_one', 'twitter_social_two', 'twitter_social_three', 'twitter_social_four']

    ##Databases variables
    facebook_pages_union_databases: ['facebook_pages_one','facebook_pages_two']
    linkedin_pages_union_databases: ['linkedin_company_pages_one', 'linkedin_company_pages_two']
    instagram_business_union_databases: ['instagram_business_one', 'instagram_business_two', 'instagram_business_three']
    twitter_organic_union_databases: ['twitter_social_one', 'twitter_social_two', 'twitter_social_three', 'twitter_social_four']

For more configuration information, see the individual connector dbt packages (listed above).

Database Support

This package has been tested on BigQuery, Snowflake, Redshift, PostgreSQL, and Databricks.

Databricks Dispatch Configuration

dbt v0.20.0 introduced a new project-level dispatch configuration that enables an "override" setting for all dispatched macros. 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.

# dbt_project.yml

dispatch:
  - macro_namespace: dbt_utils
    search_order: ['spark_utils', 'dbt_utils']

🔍 Does this package have dependencies?

This dbt package is dependent on the following dbt packages. Please be aware that 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.yml file, we highly recommend that you remove them from your root packages.yml to avoid package version conflicts.

packages:
    - package: fivetran/facebook_pages
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/facebook_pages_source
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/instagram_business
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/instagram_business_source
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/twitter_organic
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/twitter_organic_source
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/linkedin_pages
      version: [">=0.2.0", "<0.3.0"]

    - package: fivetran/linkedin_pages_source
      version: [">=0.2.0", "<0.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"]

Contributions

Additional contributions to this package are very welcome! Please create issues or open PRs against main. Check out this post on the best workflow for contributing to a package.

Resources:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.