Skip to content

Commit

Permalink
Merge pull request #5 from fivetran/feature/dbt20-upgrade
Browse files Browse the repository at this point in the history
dbt 20 compatibility upgrades
  • Loading branch information
fivetran-joemarkiewicz authored Jul 24, 2021
2 parents e0703be + 9573f15 commit 188313c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Apache License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![dbt logo and version](https://img.shields.io/static/v1?logo=dbt&label=dbt-version&message=0.20.x&color=orange)
# Snapchat Ads (Source)

This package models Snapchat Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/snapchat-ads). It uses data in the format described by [this ERD](https://fivetran.com/docs/applications/snapchat-ads#schemainformation).
Expand All @@ -13,6 +14,14 @@ This package contains staging models, designed to work simultaneously with our [

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.

Include in your `packages.yml`

```yaml
packages:
- package: fivetran/snapchat_ads_source
version: [">=0.2.0", "<0.3.0"]
```
## Configuration
By default, this package will look for your Snapchat Ads data in the `snapchat_ads` 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 Snapchat Ads data is, please add the following configuration to your `dbt_project.yml` file:
Expand Down Expand Up @@ -50,9 +59,19 @@ Please create issues or open PRs against `master`. See [the Discourse post](http

This package has been tested on BigQuery, Snowflake, Redshift, Postgres, 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.
```yml
# dbt_project.yml
dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils']
```

## Resources:
- Provide [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next
- Have questions or feedback, or need help? Book a time during our office hours [here](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or shoot us an email at [email protected].
- Have questions or feedback, or need help? Book a time during our office hours [here](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at [email protected].
- Find all of Fivetran's pre-built dbt packages in our [dbt hub](https://hub.getdbt.com/fivetran/)
- Learn how to orchestrate dbt transformations with Fivetran [here](https://fivetran.com/docs/transformations/dbt).
- Learn more about Fivetran overall [in our docs](https://fivetran.com/docs)
Expand Down
6 changes: 2 additions & 4 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

name: 'snapchat_ads_source'
version: '0.1.2'
version: '0.2.0'
config-version: 2
require-dbt-version: [">=0.19.0", "<0.20.0"]
require-dbt-version: ">=0.20.0"

vars:
snapchat_ads_source:
Expand All @@ -13,8 +13,6 @@ vars:
campaign_history: "{{ source('snapchat_ads','campaign_history') }}"
creative_history: "{{ source('snapchat_ads','creative_history') }}"
creative_url_tag_history: "{{ source('snapchat_ads','creative_url_tag_history') }}"
dbt_utils_dispatch_list: ['spark_utils', 'fivetran_utils']
fivetran_utils_dispatch_list: ['spark_utils']

models:
snapchat_ads_source:
Expand Down
8 changes: 6 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'snapchat_ads_source_integration_tests'
version: '0.1.2'
version: '0.2.0'
profile: 'integration_tests'
config-version: 2

Expand All @@ -11,4 +11,8 @@ vars:
ad_squad_history: "{{ ref('snapchat_ad_squad_history_data') }}"
campaign_history: "{{ ref('snapchat_campaign_history_data') }}"
creative_history: "{{ ref('snapchat_creative_history_data') }}"
creative_url_tag_history: "{{ ref('snapchat_creative_url_tag_history_data') }}"
creative_url_tag_history: "{{ ref('snapchat_creative_url_tag_history_data') }}"

dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils']
6 changes: 3 additions & 3 deletions integration_tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dbt==0.19.1
dbt-spark==0.19.1
dbt-spark[PyHive]==0.19.1
dbt~=0.20.0
dbt-spark~=0.20.0
dbt-spark[PyHive]~=0.20.0
9 changes: 4 additions & 5 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
packages:

- package: fivetran/fivetran_utils
version: [">=0.1.0", "<0.2.0"]
- package: fishtown-analytics/spark_utils
version: [">=0.2.0", "<0.3.0"]
- package: fivetran/fivetran_utils
version: [">=0.2.0", "<0.3.0"]
- package: dbt-labs/spark_utils
version: [">=0.2.0", "<0.3.0"]

0 comments on commit 188313c

Please sign in to comment.