SNOW-1892866: Named stages using spaces or special characters are not quoted in "PUT file" SQL statements #2021
Labels
status-triage_done
Initial triage done, will be further handled by the driver team
This issue pertains to a possible bug in the implementation of
SnowflakeConnectionV1.uploadStreamInternal
. It seems that this method may not be appropriately wrapping the identifier for a named stage in single quotes when it contains spaces or special characters, as is required according to the Snowflake documentation:If you have time, I'd appreciate if this could be confirmed as a bug, or if we're not utilising the method correctly on our end.
Details are included below.
1. What version of JDBC driver are you using?
v3.20.0
2. What operating system and processor architecture are you using?
macOS M1 Pro
3. What version of Java are you using?
Java 17
4. What did you do?
In one of our applications, we utilise
SnowflakeConnectionV1
via the following method:We have the following named stages defined within a Snowflake database
DATABASE_1
under schemaPUBLIC
:df_stage_name_lowercase
df_STAGE_NAme_with_MIXEd_CASing
df stage name with spaces
df_stage_name_with_~???@_special_characters
We fully-qualify the stage name we pass to
SnowflakeConnectionV1.uploadStream
and quote each part of the identifier, e.g."DATABASE_1"."PUBLIC"."df_stage_name_lowercase"
.For the first two test cases, the files are successfully loaded to the named stage. However, for the named stages containing spaces or special characters, the SQL statement used to upload the files fails to execute. For the test case
df stage name with spaces
, we get the following exception logs:The root cause appears to be that
SnowflakeConnectionV1.uploadStreamInternal
does not wrap the entire identifier in single quotes when spaces or special characters are present. For this test case, the following SQL statement gets constructed:Based on the Snowflake docs referenced above, I believe it ought to be:
5. What did you expect to see?
I expect that the Snowflake connector succeeds in uploading files to named stages regardless of whether there are spaces or special characters in the name.
6. Can you set logging to DEBUG and collect the logs?
I believe the logs included below should be sufficient to debug the issue, but let me know if more logs are required:
The text was updated successfully, but these errors were encountered: