Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for dbt-utils to dbt-core cross-db macro migration #14

Merged
merged 38 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e809eee
Updates for dbt-utils to dbt-core cross-db macro migration
fivetran-sheringuyen Oct 14, 2022
512a41a
Updating dbt version
fivetran-sheringuyen Oct 14, 2022
6a49b24
Updating package dependencies
fivetran-sheringuyen Oct 14, 2022
1d9fd75
deleting file: .circleci/config.yml
fivetran-sheringuyen Oct 14, 2022
b969b2f
deleting file: integration_tests/requirements.txt
fivetran-sheringuyen Oct 14, 2022
33ed8f7
deleting file: integration_tests/ci/sample.profiles.yml
fivetran-sheringuyen Oct 14, 2022
05ced39
adding file: integration_tests/requirements.txt
fivetran-sheringuyen Oct 14, 2022
9573e1c
adding file: integration_tests/ci/sample.profiles.yml
fivetran-sheringuyen Oct 14, 2022
83330c5
adding file: .buildkite/pipeline.yml
fivetran-sheringuyen Oct 14, 2022
d0b9bd9
adding file: .buildkite/scripts/run_models.sh
fivetran-sheringuyen Oct 14, 2022
2446ba4
adding file: .buildkite/hooks/pre-command
fivetran-sheringuyen Oct 14, 2022
820e7d3
Update dbt adapter versions and dbt required versions
fivetran-sheringuyen Oct 17, 2022
d81da0d
pr updates
fivetran-sheringuyen Oct 25, 2022
7a88046
updating dbt utils vers and pipeline
fivetran-sheringuyen Oct 26, 2022
e16b84f
updating changelog
fivetran-sheringuyen Oct 26, 2022
1bc024c
updating docs
fivetran-sheringuyen Oct 26, 2022
5ede396
Update pipeline, CI refs, run models
fivetran-sheringuyen Nov 17, 2022
1861d6f
copy joes PR
fivetran-jamie Nov 30, 2022
6bb95f8
integration tests
fivetran-jamie Nov 30, 2022
8d730c6
feature/enable-null-urls
fivetran-catfritz Dec 8, 2022
9cacb21
rename variab
fivetran-catfritz Dec 8, 2022
4a71c12
update run_mode
fivetran-catfritz Dec 9, 2022
01da0ab
update run_mode
fivetran-catfritz Dec 9, 2022
696eedd
update run_models
fivetran-catfritz Dec 9, 2022
2aca77a
update ymls
fivetran-catfritz Dec 9, 2022
5fa6fb7
update ymls
fivetran-catfritz Dec 9, 2022
64e822e
update ymls
fivetran-catfritz Dec 9, 2022
2ce34a1
update changelog and readme
fivetran-catfritz Dec 10, 2022
23f9b7b
ymls
fivetran-catfritz Dec 12, 2022
324dcaf
logic and document
fivetran-catfritz Dec 14, 2022
5a9ea0f
regen docs
fivetran-catfritz Dec 14, 2022
3637745
update int test ymls
fivetran-catfritz Dec 14, 2022
d2278b6
update int test ymls
fivetran-catfritz Dec 15, 2022
572d315
Merge pull request #17 from fivetran/feature/enable-null-urls
fivetran-catfritz Dec 15, 2022
0f4cec7
docs regen
fivetran-joemarkiewicz Dec 19, 2022
3e528b8
merge conflicts
fivetran-joemarkiewicz Dec 20, 2022
1ae046f
docs regen
fivetran-joemarkiewicz Dec 20, 2022
c086c86
update package dependency
fivetran-joemarkiewicz Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ dbt deps
dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{twitter_ads__using_keywords: False}' --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{twitter_ads__using_keywords: false, ad_reporting__url_report__using_null_filter: false}' --target "$db" --full-refresh
dbt test --vars '{twitter_ads__using_keywords: false, ad_reporting__url_report__using_null_filter: false}' --target "$db"
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
# dbt_twitter v0.6.0

## 🚨 Breaking Changes 🚨:
[PR #14](https://github.com/fivetran/dbt_twitter/pull/14) 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"]`.

## 🎉 Features 🎉
- For use in the [dbt_ad_reporting package](https://github.com/fivetran/dbt_ad_reporting), users can now allow records having nulls in url fields to be included in the `ad_reporting__url_report` model. See the [dbt_ad_reporting README](https://github.com/fivetran/dbt_ad_reporting) for more details. [#17](https://github.com/fivetran/dbt_twitter/pull/17)
## 🚘 Under the Hood 🚘
- Disabled the `not_null` test for `twitter_ads__url_report` when null urls are allowed. [#17](https://github.com/fivetran/dbt_twitter/pull/17)

# dbt_twitter v0.5.1
## Fixes
- Fix the package name in the README ([#16](https://github.com/fivetran/dbt_twitter/pull/16))
Expand Down
12 changes: 7 additions & 5 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/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 @@ -52,7 +52,7 @@ Include the following Twitter package version in your `packages.yml` file:
# packages.yml
packages:
- package: fivetran/twitter_ads
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 @@ -133,11 +133,13 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
```yml
packages:
- package: fivetran/twitter_source
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
- 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: 2 additions & 6 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: 'twitter_ads'
version: '0.5.1'
version: '0.6.0'
config-version: 2
require-dbt-version: [">=1.0.0", "<2.0.0"]

require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
twitter_ads:
+schema: twitter_ads
+materialized: table

vars:
twitter_ads:
line_item_history: "{{ ref('stg_twitter_ads__line_item_history') }}"
Expand All @@ -20,9 +18,7 @@ vars:
campaign_report: "{{ ref('stg_twitter_ads__campaign_report') }}"
line_item_report: "{{ ref('stg_twitter_ads__line_item_report') }}"
line_item_keywords_report: "{{ ref('stg_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: []
twitter_ads__promoted_tweet_report_passthrough_metrics: []

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.

10 changes: 5 additions & 5 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: twitter_ads_integration_tests
schema: twitter_ads_integration_tests_3
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: twitter_ads_integration_tests
schema: twitter_ads_integration_tests_3
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: twitter_ads_integration_tests
schema: twitter_ads_integration_tests_3
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: twitter_ads_integration_tests
schema: twitter_ads_integration_tests_3
threads: 8
databricks:
catalog: null
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: twitter_ads_integration_tests
schema: twitter_ads_integration_tests_3
threads: 2
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
4 changes: 2 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'twitter_integration_tests'
version: '0.5.1'
version: '0.6.0'
profile: 'integration_tests'
config-version: 2
snapshot-paths: ["snapshots"]

vars:
twitter_ads_source:
twitter_ads_schema: twitter_ads_integration_tests
twitter_ads_schema: twitter_ads_integration_tests_3

twitter_ads_account_history_identifier: "twitter_account_history_data"
twitter_ads_campaign_history_identifier: "twitter_campaign_history_data"
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
8 changes: 8 additions & 0 deletions models/twitter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ models:
- line_item_id
- campaign_id
- account_id
config:
# Below is so we don't run this test if the user has allowed urls to have null entries
enabled: "{{ var('ad_reporting__url_report__using_null_filter', True) }}"
columns:
- name: date_day
description: The date of the performance.
Expand Down Expand Up @@ -371,6 +374,11 @@ models:
description: The full text of the tweet that the URL appeared in.
- name: base_url
description: The base URL of the ad, extracted from the `expanded_url`.
tests:
- not_null:
config:
# Below is so we don't run this test if the user has allowed urls to have null entries
enabled: "{{ var('ad_reporting__url_report__using_null_filter', True) }}"
- name: url_host
description: The URL host of the ad, extracted from the `expanded_url`.
- name: url_path
Expand Down
6 changes: 4 additions & 2 deletions models/twitter_ads__url_report.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ final as (
left join accounts
on report.account_id = accounts.account_id

where tweet_url.expanded_url is not null

{% if var('ad_reporting__url_report__using_null_filter', True) %}
where tweet_url.expanded_url is not null
{% endif %}

{{ dbt_utils.group_by(n=23) }}


Expand Down
4 changes: 2 additions & 2 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- package: fivetran/twitter_ads_source
version: [">=0.5.0", "<0.6.0"]
- package: fivetran/twitter_ads_source
version: [">=0.6.0", "<0.7.0"]