Skip to content

Commit

Permalink
Update package to use the package extract_url_parameter macro
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-joemarkiewicz committed Dec 11, 2023
1 parent 414e9ea commit 4d7cd04
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 7 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'auto release'
on:
pull_request:
types:
- closed
branches:
- main

jobs:
call-workflow-passing-data:
if: github.event.pull_request.merged
uses: fivetran/dbt_package_automations/.github/workflows/auto-release.yml@feature/auto-releaser
secrets: inherit
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# dbt_google_ads_source v0.10.1
[PR #]() includes the following updates: ## Bug Fixes - This package now leverages the new `google_ads_extract_url_parameter()` for use in parsing out url parameters. This was added to create special logic for Databricks instances not supported by `dbt_utils.get_url_parameter()`.
- This macro will be replaced with the `fivetran_utils.extract_url_parameter()` in the next breaking change.

# dbt_google_ads_source v0.10.0

[PR #43](https://github.com/fivetran/dbt_google_ads_source/pull/43) includes the following updates:
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'google_ads_source'
version: '0.10.0'
version: '0.10.1'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
vars:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'google_ads_source_integration_tests'
version: '0.10.0'
version: '0.10.1'
profile: 'integration_tests'
config-version: 2

Expand Down
20 changes: 20 additions & 0 deletions macros/google_ads_extract_url_parameters.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% macro google_ads_extract_url_parameter(field, url_parameter) -%}

{{ adapter.dispatch('google_ads_extract_url_parameter', 'google_ads') (field, url_parameter) }}

{% endmacro %}


{% macro default__google_ads_extract_url_parameter(field, url_parameter) -%}

{{ dbt_utils.get_url_parameter(field, url_parameter) }}

{%- endmacro %}


{% macro spark__google_ads_extract_url_parameter(field, url_parameter) -%}

{%- set formatted_url_parameter = "'" + url_parameter + "=([^&]+)'" -%}
nullif(regexp_extract({{ field }}, {{ formatted_url_parameter }}, 1), '')

{%- endmacro %}
10 changes: 5 additions & 5 deletions models/stg_google_ads__ad_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ url_fields as (
{{ dbt.split_part('final_url', "'?'", 1) }} as base_url,
{{ dbt_utils.get_url_host('final_url') }} as url_host,
'/' || {{ dbt_utils.get_url_path('final_url') }} as url_path,
{{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source,
{{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium,
{{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign,
{{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content,
{{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term
{{ google_ads_extract_url_parameter('final_url', 'utm_source') }} as utm_source,
{{ google_ads_extract_url_parameter('final_url', 'utm_medium') }} as utm_medium,
{{ google_ads_extract_url_parameter('final_url', 'utm_campaign') }} as utm_campaign,
{{ google_ads_extract_url_parameter('final_url', 'utm_content') }} as utm_content,
{{ google_ads_extract_url_parameter('final_url', 'utm_term') }} as utm_term
from final_urls
)

Expand Down

0 comments on commit 4d7cd04

Please sign in to comment.