Skip to content

Fivetran's app reporting dbt package. Combine your Google Play and Apple App Store activity using this package.

License

Notifications You must be signed in to change notification settings

fivetran/dbt_app_reporting

Repository files navigation

App Reporting dbt Package (Docs)

📣 What does this dbt package do?

  • Standardizes schemas from various app platform connectors and creates reporting models for all activity aggregated to the device, country, OS version, app version, traffic source and subscription levels.
  • Currently supports the following Fivetran app platform connectors:
  • Generates a comprehensive data dictionary of your source and modeled App Reporting data via the dbt docs site

Refer to the table below for a detailed view of final models materialized by default within this package. Additionally, check out our Docs site for more details about these models.

model description
app_reporting__app_version_report Each record represents daily metrics by app_name and app version.
app_reporting__country_report Each record represents daily metrics by app_name and country
app_reporting__device_report Each record represents daily metrics by app_name and device.
app_reporting__os_version_report Each record represents daily metrics by app_name and OS version.
app_reporting__overview_report Each record represents daily metrics by app_name.
app_reporting__traffic_source_report Each record represents daily metrics by app_name and traffic source.

The individual Google Play and Apple App Store models have additional platform-specific metrics better suited for deep-dive analyses.

🎯 How do I use the dbt package?

Step 1: Pre-Requisites

  • Connector: Have all relevant Fivetran app platform connectors syncing data into your warehouse. This package currently supports:
  • Database support: This package has been tested on BigQuery, Snowflake, Redshift, Postgres and Databricks. Ensure you are using one of these supported databases.
  • dbt Version: This dbt package requires you have a functional dbt project that utilizes a dbt version within the respective range >=1.0.0, <2.0.0.

Step 2: Installing the 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/app_reporting
    version: [">=0.3.0", "<0.4.0"] # we recommend using ranges to capture non-breaking changes automatically

Do NOT include the individual app platform packages in this file. The app reporting package itself has dependencies on these packages and will install them as well.

Step 3: Configure Database and Schema Variables

By default, this package looks for your app platform data in your target database. If this is not where your app platform data is stored, add the relevant <connector>_database variables to your dbt_project.yml file (see below).

By default, this package also looks for your connector data in specific schemas (itunes_connect and google_play for Apple App Store and Google Play, respectively). If your data is stored in a different schema, add the relevant <connector>_schema variables to your dbt_project.yml file (see below).

vars:
  apple_store_schema: itunes_connect
  apple_store_database: your_database_name
  
  google_play_schema: google_play
  google_play_database: your_database_name 

Step 4: Disable and Enable Source Tables

Your app platform connectors might 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 your respective app platforms or have actively excluded some tables from your syncs.

If you use subscriptions and have the follow tables enabled for:

  • Apple App Store
    • sales_subscription_event_summary
    • sales_subscription_summary
  • Google Play
    • financial_stats_subscriptions_country
    • earnings

Add the following variables to your dbt_project.yml file

vars:
  apple_store__using_subscriptions: true # by default this is assumed to be false
  google_play__using_subscriptions: true # by default this is assumed to be false
  google_play__using_earnings: true # by default this is assumed to be false

👀 Subscriptions and financial data are NOT included in app_reporting data models. This data is leveraged in the individual Google Play and Apple App Store packages, which are installed within the App Reporting package.

Step 5: Seed country_codes mapping tables (once)

In order to map longform territory names to their ISO country codes, we have adapted the CSV from lukes/ISO-3166-Countries-with-Regional-Codes to align Google and Apple's country name formats for the App Reporting package.

You will need to dbt seed the google_play__country_codes file and apple_store_country_codes file just once.

(Recommended) Step 6: Change the Build Schema

By default this package will build all models in your <target_schema> with the respective package suffixes (see below). This behavior can be tailored to your preference by making use of custom schemas. If you would like to override the current naming conventions, please add the following configuration to your dbt_project.yml file and rename +schema configs:

models:  
  app_reporting:
    +schema: app_reporting # default schema suffix

  apple_store:
    +schema: apple_store # default schema suffix
  apple_store_source:
    +schema: apple_store_source # default schema suffix
  
  google_play:
    +schema: google_play # default schema suffix
  google_play_source:
    +schema: google_play_source # default schema suffix

Provide a blank +schema: to write to the target_schema without any suffix.

(Optional) Step 7: Additional configurations

Expand to view configurations

Change the source table references

If 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 Apple Store dbt_project.yml and Google Play dbt_project.yml variable declarations to see the expected names.

vars:
    <default_source_table_name>_identifier: your_table_name 

(Optional) Step 8: Orchestrate your models with Fivetran Transformations for dbt Core™

Expand to view details

Fivetran offers the ability for you to orchestrate your dbt project through Fivetran Transformations for dbt Core™. Learn how to set up your project for orchestration through Fivetran in our Transformations for dbt Core™ setup guides.


🔍 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 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.

packages: 
    - package: fivetran/apple_store 
      version: [">=0.3.0", "<0.4.0"] 

    - package: fivetran/apple_store_source
      version: [">=0.3.0", "<0.4.0"] 

    - package: fivetran/google_play 
      version: [">=0.3.0", "<0.4.0"] 
 
    - package: fivetran/google_play_source
      version: [">=0.3.0", "<0.4.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"]

🙌 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 of the package and refer to the CHANGELOG and release notes for more information on changes across versions.

Opinionated Decisions

In creating this package, which is meant for a wide range of use cases, we had to take opinionated stances on a few different questions we came across during development. We've consolidated significant choices we made in the DECISIONLOG.md, and will continue to update as the package evolves. We are always open to and encourage feedback on these choices, and the package in general.

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 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 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.
  • Have questions or want to just say hi? Book a time during our office hours here or send us an email at [email protected].