diff --git a/integration_tests/data/web/data_url_host.csv b/integration_tests/data/web/data_url_host.csv index c32fbf8d..2350bb7a 100644 --- a/integration_tests/data/web/data_url_host.csv +++ b/integration_tests/data/web/data_url_host.csv @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/macros/web/get_url_host.sql b/macros/web/get_url_host.sql index b1e8e4de..d6662576 100644 --- a/macros/web/get_url_host.sql +++ b/macros/web/get_url_host.sql @@ -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 %} \ No newline at end of file