Issue


When attempting to upload files to Snowflake using the PUT command, the process fails if the same file name is reused for multiple uploads. The second upload is skipped, and the file is not replaced.

This behavior occurs because Snowflake does not overwrite existing staged files by default and skips the PUT command when the destination file name already exists.


Cause

Snowflake does not overwrite existing staged files by default and skips PUT when the destination file name already exists


Solution


To resolve this issue, you can implement one of the following approaches:

  1. Force overwrite in the PUT command:
    PUT file:///path/to/file @stage_name AUTO_COMPRESS=TRUE OVERWRITE=TRUE;
  2. Remove the existing file before uploading:
    REMOVE @stage_name 'file_name'; PUT file:///path/to/file @stage_name AUTO_COMPRESS=TRUE;
  3. Use unique file names by generating unique names (e.g., using a timestamp or execution ID) instead of reusing the same generic file name.


This behavior is driven by Snowflake stage handling and is independent of xDI logic. The recommended adjustments above will prevent the issue and ensure reliable loading.