从 S3 使用 Snowpipe 自动摄取时,如何在 Snowflake table 中连续刷新数据,即加载新数据和删除旧数据?

How to continuously refresh data in a Snowflake table when using Snowpipe auto-ingest from S3 i.e. load new and drop old data?

创建了一个 Snowpipe,它根据 [1] 自动摄取 S3 中的文件。文件不断地放入 S3 存储桶中,自动 Snowpipe 将数据加载到 Snowflake table.

根据 [2],S3 存储桶具有删除旧文件的生命周期规则。但是,Snowpipe 似乎附加到 Snowflake table 而不是覆盖;即使文件已从 S3 中删除。

我想在 S3 中删除文件时从 Snowflake table 中删除数据。是否有使用 Snowpipe 或在 Snowflake 中执行此操作的优雅解决方案?

P.S。我可以找到类似的问题,但没有答案。如果存在,请告诉我答案。谢谢

参考资料: [1] https://docs.snowflake.com/en/user-guide/data-load-snowpipe-auto-s3.html [2] https://docs.snowflake.com/en/user-guide/data-load-snowpipe-manage.html

目前,Snowpipe只是一个加载数据的工具;它将暂存数据加载到目标 table 中,没有可用的 update/merge 逻辑。如果您需要在加载数据之前对其应用逻辑,您可以先将数据加载到分段 table 中,然后将数据插入/update/merge 到目标 table.