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-1964421: Can't PUT local file into internal stage if query starts with newline #1326

Open
tzachshabtay opened this issue Mar 5, 2025 · 5 comments
Assignees
Labels
bug Erroneous or unexpected behaviour status-pr_pending_merge A PR is made and is under review status-triage_done Initial triage done, will be further handled by the driver team

Comments

@tzachshabtay
Copy link

Hi, I'm trying to exec PUT file:///tmp/mypath.csv @MYSCHEMA.MYSTAGE/mypath;, I'm getting back the error:

000002 (0A000): Unsupported feature 'unsupported_requested_format:snowflake'.

I saw this was reported 6 years ago and the answer this will be high priority to fix, but then the issue derailed to another request and closed, so is it possible that support was never added and this was accidentally neglected?

  1. What version of GO driver are you using?
    v1.13.1

  2. What operating system and processor architecture are you using?

Linux ip-10-17-21-180 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  1. What version of GO are you using?
go version go1.23.6 linux/amd64

4.Server version:* E.g. 1.90.1
9.5.1

Thanks.

@tzachshabtay tzachshabtay added the bug Erroneous or unexpected behaviour label Mar 5, 2025
@github-actions github-actions bot changed the title Can't PUT local file into internal stage SNOW-1964421: Can't PUT local file into internal stage Mar 5, 2025
@sfc-gh-wfateem
Copy link
Collaborator

@tzachshabtay thanks for reaching out. That issue you referenced is pretty old and back then the Go driver didn't support the PUT query, but it definitely does now.

Here's an example of the log messages I see when running a test issuing a PUT query:

time="2025-03-05T19:39:25-06:00" level=info msg="Query: \"put file:///tmp/test.csv  @~/ overwrite=True;\", []" func="gosnowflake.(*snowflakeConn).queryContextInternal" file="connection.go:403"
time="2025-03-05T19:39:25-06:00" level=debug msg="empty qcc" func="gosnowflake.(*defaultLogger).Debugf" file="log.go:176"
time="2025-03-05T19:39:25-06:00" level=info msg="parameters: map[]" func="gosnowflake.(*snowflakeConn).exec" file="connection.go:117"
time="2025-03-05T19:39:25-06:00" level=info msg="bindings: map[]" func="gosnowflake.(*snowflakeConn).exec" file="connection.go:126"
time="2025-03-05T19:39:25-06:00" level=info msg="params: &map[]" func=gosnowflake.postRestfulQueryHelper file="restful.go:236"
time="2025-03-05T19:39:25-06:00" level=info msg="retryHTTP.totalTimeout: 0s" func="gosnowflake.(*retryHTTP).execute" file="retry.go:299"
time="2025-03-05T19:39:25-06:00" level=debug msg="retry count: 0" func="gosnowflake.(*retryHTTP).execute" file="retry.go:309"
time="2025-03-05T19:39:25-06:00" level=info msg="postQuery: resp: &{200 OK 200 HTTP/1.1 1 1 ...."

Are you 100% sure you're using v1.13.1? You might want to double check that from the login history to verify the client version being used in your test.

Can you share the code you're using?

@sfc-gh-wfateem sfc-gh-wfateem added the status-information_needed Additional information is required from the reporter label Mar 6, 2025
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage Issue is under initial triage label Mar 6, 2025
@tzachshabtay tzachshabtay changed the title SNOW-1964421: Can't PUT local file into internal stage SNOW-1964421: Can't PUT local file into internal stage if query starts with newline Mar 6, 2025
@tzachshabtay
Copy link
Author

@sfc-gh-wfateem thanks for the quick response. I was able to isolate the issue, the error is only returned when the query starts with a new line, once the new line is removed the query works. I updated the title with the new info.

To answer your question, yes, I'm pretty sure it's using 1.13.1, saw it in the debug logs from the driver (and in go.mod), not sure what you mean by login history though.

Repro code:

import (
	"context"
	"database/sql"
	"testing"

	"github.com/snowflakedb/gosnowflake"
	"github.com/stretchr/testify/require"
)

func Test_ReproTest(t *testing.T) {
	conf := gosnowflake.Config{
		Account:                   "myaccount",
		User:                      "myuser",
		Password:                  "mypassword",
		Database:                  "MYDATABASE",
		Role:                      "MYROLE",
		Warehouse:                 "",
		ValidateDefaultParameters: gosnowflake.ConfigBoolTrue,
	}
	dsn, err := gosnowflake.DSN(&conf)
	require.NoError(t, err)

	conn, err := sql.Open("snowflake", dsn)
	require.NoError(t, err)

	_, err = conn.ExecContext(context.Background(), `
PUT file:///tmp/test.csv @MYSCHEMA.MYSTAGE/path/to/stage`)
	require.NoError(t, err)
}

@sfc-gh-wfateem
Copy link
Collaborator

Thanks @tzachshabtay
Am I correct in assuming that you don't really need the newline right before your query text, or do you actually have some sort of use case that can't be understood given this simple reproducer you shared?

@sfc-gh-pfus
Copy link
Collaborator

Hi @tzachshabtay (CC @sfc-gh-wfateem ), it seems you found a tiny bug :) Our regex doesn't ignore whitespaces.

@sfc-gh-pfus sfc-gh-pfus added status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage status-information_needed Additional information is required from the reporter labels Mar 7, 2025
@sfc-gh-pfus sfc-gh-pfus added the status-in_progress Issue is worked on by the driver team label Mar 7, 2025
@sfc-gh-pfus
Copy link
Collaborator

@sfc-gh-dszmolka sfc-gh-dszmolka added status-pr_pending_merge A PR is made and is under review and removed status-in_progress Issue is worked on by the driver team labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Erroneous or unexpected behaviour status-pr_pending_merge A PR is made and is under review status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

4 participants