问题描述
Redshift不允许我将信息架构表的查询结果写回到redshift表。因此,在DBTCloud中,我试图“缓冲”结果,然后写回redshift以解决Redshift限制。据我了解,我可以使用DBT“声明”写入Jinja上下文,然后将这些结果写回到Redshift。有任何想法吗?这是源查询:
AllowAgentForwarding
通常,我只是在上面的语句中使用“ create table tablename as ...”,但是Redshift / Postgres不允许这样做。因此,在DBTCloud中,我正在尝试“声明”,如下所示:
select
cast(table_schema as text) as table_schema,cast(table_name as text) as table_name,current_date as load_date,cast(column_name as text) as column_name,cast(data_type as text) as data_type,cast(is_nullable as text) as is_nullable,cast(column_default as text) as column_default
from information_schema.columns
where table_schema = 'schemaname'
我将上面的语句存储在Macros文件夹中,
{%- call get_schema_defs_statement('schema_defs',fetch_result=True) -%}
select
cast(table_schema as text) as table_schema,(select load_datetime from dv_stage_stripe.load_datetime) as load_datetime,cast(column_default as text) as column_default
from information_schema.columns
where table_schema = 'schemaname'
{%- endcall -%}
我不确定在此之后该怎么办...
感谢您的帮助!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)