Skip to content

Commit

Permalink
Backport android url changes from #426 (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
joellabes committed Dec 2, 2021
1 parent 614a8fc commit fd8dc17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion integration_tests/data/web/data_url_host.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
original_url,parsed_url
www.google.co.uk?utm_source=google&utm_medium=cpc&utm_campaign=spring-summer,www.google.co.uk
http://witanddelight.com/2018/01/tips-tricks-how-run-half-marathon-first-time/,witanddelight.com
https://www.nytimes.com/2018/01/01/blog,www.nytimes.com
https://www.nytimes.com/2018/01/01/blog,www.nytimes.com
android-app://m.facebook.com/,m.facebook.com
docs.nytimes.com/2021/01/01/index.js?utm_source=google,docs.nytimes.com
https://m.facebook.com/,m.facebook.com
11 changes: 6 additions & 5 deletions macros/web/get_url_host.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@

{% macro default__get_url_host(field) -%}

{%- set parsed =
{%- set parsed =
dbt_utils.split_part(
dbt_utils.split_part(
dbt_utils.replace(
dbt_utils.replace(field, "'http://'", "''"
dbt_utils.replace(
dbt_utils.replace(field, "'android-app://'", "''"
), "'http://'", "''"
), "'https://'", "''"
), "'/'", 1
), "'?'", 1
)

-%}


{{ dbt_utils.safe_cast(
parsed,
dbt_utils.type_string()
)}}


{%- endmacro %}

0 comments on commit fd8dc17

Please sign in to comment.