snowflakedb/gosnowflake

SNOW-1061246 "account" parameter is always required by `sf.DSN`?

Closed this issue · 3 comments

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of GO driver are you using
    v1.7.2

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

  3. What version of GO are you using?
    go version go1.22.0 darwin/arm64

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

  5. What did you do?

Tried to use sf.DSN to make a connection string from a *sf.Config, using a host that includes the account name, and it still requires that a separate account parameter be set, even though this should be optional from what I'm seeing here, since the account identifier is specified after the "@" sign, as part of the host.

This code produces an error 260000: account is empty

	cfg := &sf.Config{
		// Account:  "account",
		Host:     "<orgname>-<account_name>.snowflakecomputing.com",
		User:     "user",
		Password: "password",
	}

	dsn, err := sf.DSN(cfg)
	if err != nil {
		panic(err)
	}
	fmt.Println(dsn)
  1. What did you expect to see?

Ideally this would create a connection string without an account parameter, and include the host.

For example, this code works:

	cfg := &sf.Config{
		Account:  "account",
		Host:     "<orgname>-<account_name>.snowflakecomputing.com",
		User:     "user",
		Password: "password",
	}

	dsn, err := sf.DSN(cfg)
	if err != nil {
		panic(err)
	}
	fmt.Println(dsn)

It outputs this connection string: user:password@<orgname>-<account_name>.snowflakecomputing.com:443?account=account&ocspFailOpen=true&validateDefaultParameters=true

What I'd like is a way to get a connection string like this: user:password@<orgname>-<account_name>.snowflakecomputing.com:443?ocspFailOpen=true&validateDefaultParameters=true

  1. Can you set logging to DEBUG and collect the logs?

N/A

  1. What is your Snowflake account identifier, if any? (Optional)

N/A

Hi - indeed the linked documentation bit might be a bit confusing. I believe the account is always mandatory (for other drivers too, besides the gosnowflake one) and might be optional only if you're using the connection string, something like this:
db, err := sql.Open("snowflake", "jsmith:mypassword@my_organization-my_account/mydb/testschema?warehouse=mywh")

Could this be something which works for you ?

Yes building the connection string by hand would work and I've tested that it does work without the account parameter. But I was expecting this to be optional when using sf.DSN as well.

good to hear it's working for you ! for the sf.DSN, I'm afraid you'll need to use the account as a non-optional parameter as documented.

Since this works as expected, I'm now marking this issue as closed but if you feel it's still a bug, please comment and I can reopen and look further.