Snowflake adds DELETING WHERE to INSERT OVERWRITE
Pipelines can clear stale results when a join returns fewer rows and refresh a recent time window to pick up late-arriving data.
Snowflake added DELETING WHERE to INSERT OVERWRITE, letting users remove selected rows and insert fresh query results in one statement. The company says the clause is available in SQL data manipulation and in Dynamic Tables that run user-defined SQL at refresh time, a mode it calls custom incrementalization. In that mode, the statement targets SELF, the dynamic table being refreshed, inside REFRESH USING.
When a source record changes and a join returns fewer matches, the refresh can clear all stored results for that record and write back the current matches. The refresh can clear the stored results if the record no longer matches anything.
Snowflake says DELETING WHERE selects existing rows to remove. Snowflake inserts every row the replacement query returns and rolls back the deletion if the insert fails.
In Snowflake’s worked Dynamic Tables example, the refresh identifies changed records by key before joining them to lookup tables. One changed record goes from four stored results to one. Changes confined to a lookup table leave the results for unchanged source records in place in this example.
Snowflake’s release note also describes recomputing and replacing a recent time window in a custom incremental Dynamic Table to include late-arriving updates.
For a standalone INSERT OVERWRITE, Snowflake’s reference says the executing role needs INSERT and DELETE privileges on the target table.
More news

Snowflake makes SQL controls for Iceberg table properties generally available

Snowflake makes error logging and CHECK enforcement generally available for Snowpipe and COPY INTO

Google Cloud details how AlloyDB Omni calls local models from SQL
