Home > Software engineering >  Delete S3 objects using snowflake query
Delete S3 objects using snowflake query

Time:09-24

We are using storage integration to unload data in AWS S3 Bucket. This is an external stage. Below is the command which we are using

COPY INTO s3://mybucket/data/files/20210922 FROM (SELECT * FROM TABLE_NAME)
                                STORAGE_INTEGRATION = SI_NAME
                                FILE_FORMAT=(TYPE=parquet)
                                MAX_FILE_SIZE=32000000
                                OVERWRITE=TRUE
                                SINGLE=FALSE
                                HEADER=TRUE

Is there any way to drop these files from s3 using storage integration or any snowflake query?

Any guidance would be helpful. Thanks in advance.

CodePudding user response:

You can use the REMOVE command or its synonym RM to do that:

https://docs.snowflake.com/en/sql-reference/sql/remove.html#remove

  • Related