Skip to content

Commit

Permalink
Merge pull request #16 from fivetran/MagicBot/dbt-utils-cross-db-migr…
Browse files Browse the repository at this point in the history
…ation

Updates for dbt-utils to dbt-core cross-db macro migration
  • Loading branch information
fivetran-joemarkiewicz authored Dec 20, 2022
2 parents 17b7f30 + d7be355 commit 9e1cadf
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 126 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# dbt_twitter_source v0.6.0

## 🚨 Breaking Changes 🚨:
[PR #16](https://github.com/fivetran/dbt_twitter_source/pull/16) includes the following breaking changes:
- Dispatch update for dbt-utils to dbt-core cross-db macros migration. Specifically `{{ dbt_utils.<macro> }}` have been updated to `{{ dbt.<macro> }}` for the below macros:
- `any_value`
- `bool_or`
- `cast_bool_to_text`
- `concat`
- `date_trunc`
- `dateadd`
- `datediff`
- `escape_single_quotes`
- `except`
- `hash`
- `intersect`
- `last_day`
- `length`
- `listagg`
- `position`
- `replace`
- `right`
- `safe_cast`
- `split_part`
- `string_literal`
- `type_bigint`
- `type_float`
- `type_int`
- `type_numeric`
- `type_string`
- `type_timestamp`
- `array_append`
- `array_concat`
- `array_construct`
- For `current_timestamp` and `current_timestamp_in_utc` macros, the dispatch AND the macro names have been updated to the below, respectively:
- `dbt.current_timestamp_backcompat`
- `dbt.current_timestamp_in_utc_backcompat`
- Dependencies on `fivetran/fivetran_utils` have been upgraded, previously `[">=0.3.0", "<0.4.0"]` now `[">=0.4.0", "<0.5.0"]`.


# dbt_twitter_source v0.5.1

## Fixes
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
href="https://github.com/fivetran/dbt_twitter_source/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
<a alt="dbt-core">
<img src="https://img.shields.io/badge/dbt_Core™_version->=1.0.0_<2.0.0-orange.svg" /></a>
<img src="https://img.shields.io/badge/dbt_Core™_version->=1.3.0_<2.0.0-orange.svg" /></a>
<a alt="Maintained?">
<img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" /></a>
<a alt="PRs">
Expand Down Expand Up @@ -42,7 +42,7 @@ Include the following twitter_source package version in your `packages.yml` file
# packages.yml
packages:
- package: fivetran/twitter_ads_source
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
```

## Step 3: Define database and schema variables
Expand Down Expand Up @@ -122,9 +122,11 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
```yml
packages:
- package: fivetran/fivetran_utils
version: [">=0.3.0", "<0.4.0"]
version: [">=0.4.0", "<0.5.0"]
- package: dbt-labs/dbt_utils
version: [">=0.8.0", "<0.9.0"]
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?
Expand Down
8 changes: 3 additions & 5 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: 'twitter_ads_source'
version: '0.5.1'
version: '0.6.0'

config-version: 2
require-dbt-version: [">=1.0.0", "<2.0.0"]

config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
twitter_ads_source:
+materialized: table
+schema: twitter_ads_source
tmp:
+materialized: view

vars:
twitter_ads_source:
account_history: "{{ source('twitter_ads','account_history') }}"
Expand All @@ -23,7 +22,6 @@ vars:
campaign_report: "{{ source('twitter_ads','campaign_report') }}"
line_item_report: "{{ source('twitter_ads','line_item_report') }}"
line_item_keywords_report: "{{ source('twitter_ads','line_item_keywords_report') }}"

twitter_ads__campaign_report_passthrough_metrics: []
twitter_ads__line_item_report_passthrough_metrics: []
twitter_ads__line_item_keywords_report_passthrough_metrics: []
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 'twitter_source_integration_tests'
version: '0.5.1'
version: '0.6.0'


profile: 'integration_tests'
config-version: 2
Expand Down
14 changes: 7 additions & 7 deletions integration_tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dbt-snowflake>=1.0.0,<1.3.0
dbt-bigquery>=1.0.0,<1.3.0
dbt-redshift>=1.0.0,<1.3.0
dbt-postgres>=1.0.0,<1.3.0
dbt-spark>=1.0.0,<1.3.0
dbt-spark[PyHive]>=1.0.0,<1.3.0
dbt-databricks>=1.0.0,<1.3.0
dbt-snowflake>=1.3.0,<2.0.0
dbt-bigquery>=1.3.0,<2.0.0
dbt-redshift>=1.3.0,<2.0.0
dbt-postgres>=1.3.0,<2.0.0
dbt-spark>=1.3.0,<2.0.0
dbt-spark[PyHive]>=1.3.0,<2.0.0
dbt-databricks>=1.3.0,<2.0.0
16 changes: 8 additions & 8 deletions macros/get_campaign_report_columns.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% macro get_campaign_report_columns() %}

{% set columns = [
{"name": "account_id", "datatype": dbt_utils.type_string()},
{"name": "billed_charge_local_micro", "datatype": dbt_utils.type_int()},
{"name": "campaign_id", "datatype": dbt_utils.type_string()},
{"name": "clicks", "datatype": dbt_utils.type_int()},
{"name": "date", "datatype": dbt_utils.type_timestamp()},
{"name": "impressions", "datatype": dbt_utils.type_int()},
{"name": "placement", "datatype": dbt_utils.type_string()},
{"name": "url_clicks", "datatype": dbt_utils.type_int()}
{"name": "account_id", "datatype": dbt.type_string()},
{"name": "billed_charge_local_micro", "datatype": dbt.type_int()},
{"name": "campaign_id", "datatype": dbt.type_string()},
{"name": "clicks", "datatype": dbt.type_int()},
{"name": "date", "datatype": dbt.type_timestamp()},
{"name": "impressions", "datatype": dbt.type_int()},
{"name": "placement", "datatype": dbt.type_string()},
{"name": "url_clicks", "datatype": dbt.type_int()}
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('twitter_ads__campaign_report_passthrough_metrics')) }}
Expand Down
18 changes: 9 additions & 9 deletions macros/get_line_item_keywords_report_columns.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% macro get_line_item_keywords_report_columns() %}

{% set columns = [
{"name": "account_id", "datatype": dbt_utils.type_string()},
{"name": "billed_charge_local_micro", "datatype": dbt_utils.type_int()},
{"name": "clicks", "datatype": dbt_utils.type_int()},
{"name": "date", "datatype": dbt_utils.type_timestamp()},
{"name": "impressions", "datatype": dbt_utils.type_int()},
{"name": "line_item_id", "datatype": dbt_utils.type_string()},
{"name": "placement", "datatype": dbt_utils.type_string()},
{"name": "segment", "datatype": dbt_utils.type_string()},
{"name": "url_clicks", "datatype": dbt_utils.type_int()}
{"name": "account_id", "datatype": dbt.type_string()},
{"name": "billed_charge_local_micro", "datatype": dbt.type_int()},
{"name": "clicks", "datatype": dbt.type_int()},
{"name": "date", "datatype": dbt.type_timestamp()},
{"name": "impressions", "datatype": dbt.type_int()},
{"name": "line_item_id", "datatype": dbt.type_string()},
{"name": "placement", "datatype": dbt.type_string()},
{"name": "segment", "datatype": dbt.type_string()},
{"name": "url_clicks", "datatype": dbt.type_int()}
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('twitter_ads__line_item_keywords_report_passthrough_metrics')) }}
Expand Down
16 changes: 8 additions & 8 deletions macros/get_line_item_report_columns.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% macro get_line_item_report_columns() %}

{% set columns = [
{"name": "account_id", "datatype": dbt_utils.type_string()},
{"name": "billed_charge_local_micro", "datatype": dbt_utils.type_int()},
{"name": "clicks", "datatype": dbt_utils.type_int()},
{"name": "date", "datatype": dbt_utils.type_timestamp()},
{"name": "impressions", "datatype": dbt_utils.type_int()},
{"name": "line_item_id", "datatype": dbt_utils.type_string()},
{"name": "placement", "datatype": dbt_utils.type_string()},
{"name": "url_clicks", "datatype": dbt_utils.type_int()},
{"name": "account_id", "datatype": dbt.type_string()},
{"name": "billed_charge_local_micro", "datatype": dbt.type_int()},
{"name": "clicks", "datatype": dbt.type_int()},
{"name": "date", "datatype": dbt.type_timestamp()},
{"name": "impressions", "datatype": dbt.type_int()},
{"name": "line_item_id", "datatype": dbt.type_string()},
{"name": "placement", "datatype": dbt.type_string()},
{"name": "url_clicks", "datatype": dbt.type_int()},
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('twitter_ads__line_item_report_passthrough_metrics')) }}
Expand Down
10 changes: 5 additions & 5 deletions macros/get_tweet_columns.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% macro get_tweet_columns() %}

{% set columns = [
{"name": "account_id", "datatype": dbt_utils.type_string()},
{"name": "full_text", "datatype": dbt_utils.type_string()},
{"name": "id", "datatype": dbt_utils.type_string()},
{"name": "lang", "datatype": dbt_utils.type_string()},
{"name": "name", "datatype": dbt_utils.type_string()},
{"name": "account_id", "datatype": dbt.type_string()},
{"name": "full_text", "datatype": dbt.type_string()},
{"name": "id", "datatype": dbt.type_string()},
{"name": "lang", "datatype": dbt.type_string()},
{"name": "name", "datatype": dbt.type_string()},
] %}

{{ return(columns) }}
Expand Down
Loading

0 comments on commit 9e1cadf

Please sign in to comment.