[英]How to Replace/Overwrite only certain values in Snowflake Table?
I have a Snowflake SQL command in the form of:我有一个 Snowflake SQL 命令,格式如下:
CREATE TASK REPLACE_CERTAIN_ROWS
WAREHOUSE=<MY_WAREHOUSE>
SCHEDULE='USING CRON 0 5,17 * * * UTC'
AS
insert overwrite into <MY_SCHEMA>.<MY_TABLE>(FIELD1,FIELD2)
<MY_SQL>
And my table looks like:我的桌子看起来像:
FIELD1|FIELD2
ABC,REPLACE
DEF,REPLACE
GHI,DONTREPLACE
JKL,DONTREPLACE
Instead of replacing the entire table how can I alter my Snowflake to only overwrite the FIELD2="REPLACE" rows?我怎样才能改变我的雪花以仅覆盖 FIELD2="REPLACE" 行,而不是替换整个表? Do I have to first have a command that deletes these rows or is there a way to do it more instantaneously?
我是否必须首先有一个删除这些行的命令,或者有没有办法更即时地做到这一点? I know I can only execute one command per Snowflake task so would like to avoid managing dependent tasks and do it all in the same task/command.
我知道每个 Snowflake 任务只能执行一个命令,因此希望避免管理依赖任务并在同一个任务/命令中完成所有操作。
Desired Result:期望的结果:
FIELD1|FIELD2
GHI,DONTREPLACE <- remained
JKL,DONTREPLACE <- remained
MNO,REPLACE <- was replaced
PQR,REPLACE <- was replaced
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.