Pushkar Verma
Pushkar Verma

Reputation: 11

How can I overwrite data in Snowflake using snowpipe

I have created one snowpipe in Snowflake. But I am unable to overwrite my data in it. Is there a way I can either use delete or overwrite in snow pipe before copying my data?

Upvotes: 1

Views: 1942

Answers (2)

Sriga
Sriga

Reputation: 1321

You can create a stored procedure to execute the below task sequentially:

  • Truncate the table
  • Execute the copy command

If you want to load the data any specific time then you can schedule a stored procedure using task.

Upvotes: 2

NickW
NickW

Reputation: 9788

It would be normal practice to load the data from Snowpipe into a temporary/staging table and process it there - doubt you can process it in Snowpipe.

Please can you explain in more detail how/why you want to overwrite data in Snowpipe? Can you provide examples of what you are trying to achieve?

Answer 2

Snowpipe is used for continuous data loading from a stream, so I'm not sure why you are using it for daily loads of a single dataset?

I would create a standard COPY INTO process and then wrap it in a stored procedure that handles the target table deletion as well. You can then schedule this to run daily.

Upvotes: 1

Related Questions