Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1846830: PUT command does not transfer file for JDBC driver from 3.17.0 #1984

Open
tescnovozymes opened this issue Dec 5, 2024 · 16 comments
Assignees
Labels
bug status-triage_done Initial triage done, will be further handled by the driver team

Comments

@tescnovozymes
Copy link

First reported here:
DB Loader not working with Snowflake driver from 3.17

Using command: PUT 'file:///C:/KNIME/test.csv' '@~' AUTO_COMPRESS=FALSE;
And then listing with: list '@~'

No file is transferred with drivers from and above 3.17.0

  1. What version of JDBC driver are you using?
  • snowflake-jdbc-3.20.0.jar
  • snowflake-jdbc-3.19.1.jar
  • snowflake-jdbc-3.18.0.jar
  • snowflake-jdbc-3.17.0.jar
  1. What operating system and processor architecture are you using?
    Windows 11, running KNIME 5.2.2

  2. What version of Java are you using?
    KNIME 5.2.x ships with JRE 17

  3. What did you do?

Registrated different drivers in KNIME:

drivers/snowflake_test_3.14.1/name=Snowflake Test 3.14.1
drivers/snowflake_test_3.14.1/database_type=snowflake
drivers/snowflake_test_3.14.1/description=Snowflake JDBC Driver Test
drivers/snowflake_test_3.14.1/driver_class=net.snowflake.client.jdbc.SnowflakeDriver
drivers/snowflake_test_3.14.1/paths/0=C:\\KNIME\\snowflake_test\\snowflake-jdbc-3.14.1.jar
drivers/snowflake_test_3.14.1/url_template=jdbc\:snowflake\://novozymes-prod.snowflakecomputing.com/?warehouse\=<warehouse>&role\=[role]&db\=[database]&schema\=[schema]
drivers/snowflake_test_3.14.1/version=3.14.1
drivers/snowflake_test_3.16.1/name=Snowflake Test 3.16.1
drivers/snowflake_test_3.16.1/database_type=snowflake
drivers/snowflake_test_3.16.1/description=Snowflake JDBC Driver Test
drivers/snowflake_test_3.16.1/driver_class=net.snowflake.client.jdbc.SnowflakeDriver
drivers/snowflake_test_3.16.1/paths/0=C:\\KNIME\\snowflake_test\\snowflake-jdbc-3.16.1.jar
drivers/snowflake_test_3.16.1/url_template=jdbc\:snowflake\://novozymes-prod.snowflakecomputing.com/?warehouse\=<warehouse>&role\=[role]&db\=[database]&schema\=[schema]
drivers/snowflake_test_3.16.1/version=3.16.1
drivers/snowflake_test_3.17.0/name=Snowflake Test 3.17.0
drivers/snowflake_test_3.17.0/database_type=snowflake
drivers/snowflake_test_3.17.0/description=Snowflake JDBC Driver Test
drivers/snowflake_test_3.17.0/driver_class=net.snowflake.client.jdbc.SnowflakeDriver
drivers/snowflake_test_3.17.0/paths/0=C:\\KNIME\\snowflake_test\\snowflake-jdbc-3.17.0.jar
drivers/snowflake_test_3.17.0/url_template=jdbc\:snowflake\://novozymes-prod.snowflakecomputing.com/?warehouse\=<warehouse>&role\=[role]&db\=[database]&schema\=[schema]
drivers/snowflake_test_3.17.0/version=3.17.0
drivers/snowflake_test_3.20.0/name=Snowflake Test 3.20.0
drivers/snowflake_test_3.20.0/database_type=snowflake
drivers/snowflake_test_3.20.0/description=Snowflake JDBC Driver Test
drivers/snowflake_test_3.20.0/driver_class=net.snowflake.client.jdbc.SnowflakeDriver
drivers/snowflake_test_3.20.0/paths/0=C:\\KNIME\\snowflake_test\\snowflake-jdbc-3.20.0.jar
drivers/snowflake_test_3.20.0/url_template=jdbc\:snowflake\://novozymes-prod.snowflakecomputing.com/?warehouse\=<warehouse>&role\=[role]&db\=[database]&schema\=[schema]
drivers/snowflake_test_3.20.0/version=3.20.0

And then run the PUT command and list command

image

  1. What did you expect to see?

I expected to see file in user stage.

I validated query_history was listing the commands.

select q.START_TIME, q.EXECUTION_STATUS, q.ERROR_MESSAGE, q.QUERY_TEXT--, q.*
from table(information_schema.query_history()) AS q
--WHERE QUERY_TYPE = 'PUT_FILES'
WHERE USER_NAME = CURRENT_USER
order by q.START_TIME desc;
  1. Can you set logging to DEBUG and collect the logs?

No

@github-actions github-actions bot changed the title PUT command does not transfer file for JDBC driver from 3.17.0 SNOW-1846830: PUT command does not transfer file for JDBC driver from 3.17.0 Dec 5, 2024
@tescnovozymes
Copy link
Author

I tried in DBeaver community with same error

Not Working
image

Bumping down to 3.16.1 works
image

image

@sfc-gh-sghosh sfc-gh-sghosh self-assigned this Dec 9, 2024
@sfc-gh-sghosh sfc-gh-sghosh added the status-triage Issue is under initial triage label Dec 9, 2024
@sfc-gh-sghosh
Copy link
Contributor

Hello @tescnovozymes ,

Thanks for raising the issue.
I just tried with latest JDBC driver 3.20.0 and I see its uploading the file successfully via PUT command.
Both user stage and named stage working fine.

code:
Statement stmt= con.createStatement();
String str = "put 'file:////Users/sghosh/Documents/Traces/File24.csv' @~ auto_compress=false overwrite=true";
stmt.execute(str);

output:
ls @~;
I can see the file uploaded.

Could you please check again.

Regards,
Sujan

@sfc-gh-sghosh sfc-gh-sghosh added status-triage_done Initial triage done, will be further handled by the driver team status-information_needed Additional information is required from the reporter and removed bug status-triage Issue is under initial triage labels Dec 9, 2024
@tescnovozymes
Copy link
Author

Hi Sujan,

I first updated DBeaver Community to latest.
Version 24.3.0.202412011650

Then I tried with 3.16.1 driver
image

Authenticator: externalbrowser

image

image

image

image

This works

@tescnovozymes
Copy link
Author

Then I bumped to 3.20

image

image

And now no file is transferred

@tescnovozymes
Copy link
Author

https://dbeaver.io/download/#:~:text=Java%20notes%3A,in%20the%20DBeaver%20installation%20folder.

DBeaver requires Java 17 or higher. Since version 23.0 all distributions include OpenJDK 17 bundle.

@koettert
Copy link

koettert commented Dec 9, 2024

This seems to be only a problem on Windows but not on Mac or Linux. We have automatic tests for all three OS and the DB Loader tests that use the PUT command to upload files only fail on Windows but succeed on Linux and Mac.

@tescnovozymes
Copy link
Author

Bug located. Seems the has been a change in accepting PATH from 16.1 to 20.0

KNIME generates PATH with an extra /

# Not working
PUT 'file:///C:/KNIME/test.csv' '@~' AUTO_COMPRESS=FALSE;

# Working
PUT 'file://C:/KNIME/test.csv' '@~' AUTO_COMPRESS=FALSE;
PUT 'file://C:\\KNIME\\test.csv' '@~' AUTO_COMPRESS=FALSE;

@tescnovozymes
Copy link
Author

image

Yup, fault of KNIME (at least 5.2.2)

image

@tescnovozymes
Copy link
Author

Closing issue here, as this is not a fault of Snowflake driver, but a fault in KNIME code that generates the PUT command.
Reporting bag to original thread.

@koettert
Copy link

koettert commented Dec 9, 2024

The three / in the beginning of the URI is the proper URI format for local Windows paths as described here. This was accepted and properly parsed by the driver until version 3.16.1. So I would consider this a bug in the path handling of the driver and thus would reopen this issue request. It would be also great if you could explain in more detail what method you use or link to the part in the source code that parses the path argument since in the documentation it mentions that it is expecting a URI but also the space in the file name "load data" is not URI encoded e.g. load%20data.
Thanks a lot.

@sfc-gh-sghosh
Copy link
Contributor

Thank you @tescnovozymes ,

Will check and update.

Regards,
Sujan

@sfc-gh-sghosh sfc-gh-sghosh added status-triage Issue is under initial triage and removed status-triage_done Initial triage done, will be further handled by the driver team labels Dec 9, 2024
@jdimeo
Copy link

jdimeo commented Dec 12, 2024

This is definitely a regression from working past behavior. I was using Path.toUri().toString() to inject into the SQL PUT (nothing to do with KNIME) and it mysteriously stopped working with no error or non-zero query return code, but I'll try the /// -> // workaround in the short term. thanks!

@sfc-gh-sghosh
Copy link
Contributor

Hello @tescnovozymes ,

We are able to reproduce the issue, we will work on it and update.

Regards,
Sujan

@sfc-gh-sghosh
Copy link
Contributor

Hello @tescnovozymes ,

We checked further, the snowflake documentation for PUT for windows is file://C:/temp/load data.
https://docs.snowflake.com/en/sql-reference/sql/put

Windows
You must include the drive and backslash in the path and replace backslash characters with forward slashes. For example, for a file named load data use file://C:/temp/load data.

Will update further.

Regards,
Sujan

@tescnovozymes
Copy link
Author

Should the documentation then be expanded with a section, that snowflake use a custom implementation of the "file:" uri protocol and not following standards?

@sfc-gh-sghosh
Copy link
Contributor

Hello @tescnovozymes ,

We are working on the issue to fix the regression, will update further.

Regards,
Sujan

@sfc-gh-sghosh sfc-gh-sghosh removed the status-information_needed Additional information is required from the reporter label Dec 20, 2024
@sfc-gh-sghosh sfc-gh-sghosh added status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

5 participants