我正在尝试将查询从 Redshift 迁移到雪花。此查询用于填充表中的一行,并且这些值是从各种其他表中生成的。这在红移中运行良好,但我一直在尝试检查雪花文档,但无法找到雪花是否支持它。任何人都知道如何重写
insert into
etl_audit_table
(
batch_id,
batch_run_date,
table_name,
staging_row_count,
dwh_load_type
)
values
(
( select
batch_id
from
etl_cntrl.batch_history_table
where
batch_status='running'
)
,
current_date,
'tablename',
( select
count(*)
from
table
where
lastmodifieddate between '2021-07-31 00:00:00' and '2021-08-17 00:00:00'
),
'Slow Changing Dimension'
)
尝试在雪花上执行时出现以下错误
11:46:54 失败 [INSERT - 0 行,0.658 秒] [代码:2014,SQL 状态:22000] SQL 编译错误:无效表达式 [(SELECT 1 AS "BATCH_ID" FROM TABLE (GENERATOR)ROWCOUNT => 1, rowCount => 1) GENERATOR)] 在 VALUES 子句中