dbt_utils package union_relations not working with Trino #35
Closed
Description
In our project we make extensive use of the dbt_utils library. the dbt_utils.union_relations doesn't work because it generates invalid sql
create table "dataproduct_levenslangleren"."zone_levenslangleren"."levenslang_leren__dbt_tmp"
as (
(
select
cast('"dataproduct_levenslangleren"."zone_levenslangleren"."levenslang_leren_ho"' as
string
) as _dbt_source_relation,
cast("laadoperatie" as character varying(256)) as "laadoperatie" ,
cast("record max laadoperatie" as character varying(256)) as "record max laadoperatie" ,
Two issues here:
- one is with dbt core: the varying(256) is hardcoded in dbt core and doesn't use the overriden TrinoColumn class methods. see [CT-78] [Bug] Adapters should be able to override string and numeric type of columns dbt-labs/dbt-core#4603 (PR submitted)
- in dbt utils there is following method
https://github.com/dbt-labs/dbt-utils/blob/73a65562bf3d9b31a1eca0b27118056ad048d8fc/macros/cross_db_utils/datatypes.sql#L3-L6
This requires the adapter to provide specific implementation if the default ('string') is not supported:
{% macro trino__type_string() %}
varchar
{% endmacro %}
Will post PR shortly.
Metadata
Assignees
Labels
No labels