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 tables materialized by default within this package. Additionally, check out our Docs site for more details about these tables.
Table | 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 tables 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.4.0", "<0.5.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 thetarget_schema
without any suffix.
(Optional) Step 7: Additional configurations
Expand/collapse configurations
Union multiple connectors
If you have multiple app reporting connectors in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the source_relation
column of each model. To use this functionality, you will need to set either the <package_name>_union_schemas
OR <package_name>_union_databases
variables (cannot do both) in your root dbt_project.yml
file. Below are the variables and examples for each connector:
vars:
apple_store_union_schemas: ['apple_store_usa','apple_store_canada']
apple_store_union_databases: ['apple_store_usa','apple_store_canada']
google_play_union_schemas: ['google_play_usa','google_play_canada']
google_play_union_databases: ['google_play_usa','google_play_canada']
NOTE: The native
source.yml
connection set up in the package will not function when the union schema/database feature is utilized. Although the data will be correctly combined, you will not observe the sources linked to the package models in the Directed Acyclic Graph (DAG). This happens because the package includes only one definedsource.yml
.
To connect your multiple schema/database sources to the package models, follow the steps outlined in the Union Data Defined Sources Configuration section of the Fivetran Utils documentation for the union_data macro. This will ensure a proper configuration and correct visualization of connections in the DAG.
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 Playdbt_project.yml
variable declarations to see the expected names.
vars:
apple_store_<default_source_table_name>_identifier: your_table_name
google_play_<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.4.0", "<0.5.0"]
- package: fivetran/apple_store_source
version: [">=0.4.0", "<0.5.0"]
- package: fivetran/google_play
version: [">=0.4.0", "<0.5.0"]
- package: fivetran/google_play_source
version: [">=0.4.0", "<0.5.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, 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.