Skip to content

Commit

Permalink
Merge pull request #23 from fivetran/feature/enable-null-urls
Browse files Browse the repository at this point in the history
Feature/enable null urls
  • Loading branch information
fivetran-catfritz authored Dec 15, 2022
2 parents b3471f1 + 26efdfe commit cddf475
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ steps:
commands: |
bash .buildkite/scripts/run_models.sh redshift
- label: ":bricks: Run Tests - Databricks"
- label: ":databricks: Run Tests - Databricks"
key: "run_dbt_databricks"
plugins:
- docker#v3.13.0:
Expand Down
4 changes: 3 additions & 1 deletion .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ cd integration_tests
dbt deps
dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt test --target "$db"
dbt run --vars '{ad_reporting__url_report__using_null_filter: false}' --target "$db" --full-refresh
dbt test --vars '{ad_reporting__url_report__using_null_filter: false}' --target "$db"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
- `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 ([#23](https://github.com/fivetran/dbt_pinterest/pull/23)).
## 🚘 Under the Hood 🚘
- Disabled the `not_null` test for `pinterest_ads__url_report` when null urls are allowed ([#23](https://github.com/fivetran/dbt_pinterest/pull/23)).


# dbt_pinterest v0.6.0
PR [#21](https://github.com/fivetran/dbt_pinterest/pull/21) includes the following changes:
## 🚨 Breaking Changes 🚨
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.

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: pinterest_integration_tests
schema: pinterest_integration_tests_3
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: pinterest_integration_tests
schema: pinterest_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: pinterest_integration_tests
schema: pinterest_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: pinterest_integration_tests
schema: pinterest_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: pinterest_integration_tests
schema: pinterest_integration_tests_3
threads: 2
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ profile: 'integration_tests'
config-version: 2

vars:
pinterest_schema: pinterest_integration_tests
pinterest_schema: pinterest_integration_tests_3
pinterest_ad_group_history_identifier: "ad_group_history_data"
pinterest_campaign_history_identifier: "campaign_history_data"
pinterest_pin_promotion_history_identifier: "pin_promotion_history_data"
Expand Down
8 changes: 8 additions & 0 deletions models/pinterest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ models:
- campaign_id
- advertiser_id
- date_day
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: "{{ doc('date_day') }}"
Expand All @@ -26,6 +29,11 @@ models:
description: Status of the ad group.
- name: destination_url
description: Pin destination 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: pin_promotion_id
description: "{{ doc('pin_promotion_id') }}"
tests:
Expand Down
4 changes: 3 additions & 1 deletion models/pinterest_ads__url_report.sql
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ joined as (
left join advertisers
on campaigns.advertiser_id = advertisers.advertiser_id

-- We only want utm ads to populate this report. Therefore, we filter where url pins are populated.
{% if var('ad_reporting__url_report__using_null_filter', True) %}
where pins.destination_url is not null
{% endif %}

{{ dbt_utils.group_by(22) }}
)

Expand Down

0 comments on commit cddf475

Please sign in to comment.