-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
dbt_utils.get_url_parameter() doesn't work currently (neither does get_url_host
or get_url_path
).
I think it has to do with dbt_utils.split_part
:
tsql-utils/macros/dbt_utils/cross_db_utils/split_part.sql
Lines 5 to 9 in 23b11b7
{% macro sqlserver__split_part(string_text, delimiter_text, part_number) %} | |
LTRIM(CAST(('<X>'+REPLACE({{ string_text }},{{ delimiter_text }} ,'</X><X>')+'</X>') AS XML).value('(/X)[{{ part_number }}]', 'VARCHAR(128)')) | |
{% endmacro %} |
dbt-utils's integration test message is:
('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]XML parsing: line 1, character 56, semicolon expected (9411) (SQLMoreResults)')
this was the generated SQL by the integration tests...
with data as (
select * from "dbt-msft-serverless-db"."test"."data_urls"
)
select
nullif(
LTRIM(CAST(('<X>'+REPLACE(
LTRIM(CAST(('<X>'+REPLACE(url,'utm_medium=' ,'</X><X>')+'</X>') AS XML).value('(/X)[2]', 'VARCHAR(128)'))
,'&' ,'</X><X>')+'</X>') AS XML).value('(/X)[1]', 'VARCHAR(128)'))
,'') as actual,
medium as expected
from data
union all
select
nullif(
LTRIM(CAST(('<X>'+REPLACE(
LTRIM(CAST(('<X>'+REPLACE(url,'utm_source=' ,'</X><X>')+'</X>') AS XML).value('(/X)[2]', 'VARCHAR(128)'))
,'&' ,'</X><X>')+'</X>') AS XML).value('(/X)[1]', 'VARCHAR(128)'))
,'') as actual,
source as expected
from data
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed