Closed neverchanje closed 1 year ago
Could you please give an example to reproduce it?
{%- set cols = adapter.get_columns_in_relation(source('public', 'shopify_orders')) -%}
WITH source AS (
SELECT
*
FROM
{{ source(
'public',
'shopify_orders'
) }}
)
SELECT
{% for col in cols %}
{% if col.name %}
CAST(
{{ col.name }} AS {{ col.data_type }}
) AS {{ col.name }}
{% if not loop.last %},
{% endif %}
{% endif %}
{% endfor %}
FROM
source
Here is the example. First you'll need to define the source's schema in a yaml file. And even if the column type I used is varchar
, get_columns_in_relation
still returns varchar(0)
.
SELECT
CAST(
id AS character varying(0)
) AS id
,
The above is the compiled code. I've searched but found no alternative for get_columns_in_relation
.
What does postgres-dbt returns for varchar
without length?
It's because that in the postgres driver where risingwave's driver derives,
character_maximum_length
is a required param.