diff --git a/auth.go b/auth.go index aeeb61e47..42bbc7899 100644 --- a/auth.go +++ b/auth.go @@ -94,8 +94,7 @@ func postAuth( body []byte, timeout time.Duration) ( data *authResponse, err error) { - requestID := fmt.Sprintf("requestId=%v", uuid.NewV4().String()) - params.Add("requestId", requestID) + params.Add("requestId", uuid.NewV4().String()) fullURL := fmt.Sprintf( "%s://%s:%d%s", sr.Protocol, sr.Host, sr.Port, "/session/v1/login-request?"+params.Encode()) diff --git a/driver_test.go b/driver_test.go index f0bae5773..b524a2aef 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1752,6 +1752,26 @@ func TestValidateDatabaseParameter(t *testing.T) { } } +func TestSpecifyWarehouseDatabase(t *testing.T) { + dsn := fmt.Sprintf("%s:%s@%s/%s", user, pass, host, dbname) + parameters := url.Values{} + parameters.Add("account", account) + parameters.Add("warehouse", warehouse) + // parameters.Add("role", "nopublic") TODO: create nopublic role for test + if protocol != "" { + parameters.Add("protocol", protocol) + } + db, err := sql.Open("snowflake", dsn+"?"+parameters.Encode()) + if err != nil { + t.Fatalf("error creating a connection object: %s", err.Error()) + } + defer db.Close() + _, err = db.Exec("SELECT 1") + if err != nil { + t.Fatalf("failed to execute a select 1: %v", err) + } +} + func TestFetchNil(t *testing.T) { runTests(t, dsn, func(dbt *DBTest) { rows := dbt.mustQuery("SELECT * FROM values(3,4),(null, 5) order by 2") diff --git a/dsn.go b/dsn.go index 2485b0c63..704bd28b8 100644 --- a/dsn.go +++ b/dsn.go @@ -169,7 +169,6 @@ func ParseDSN(dsn string) (cfg *Config, err error) { cfg.Schema = dsn[i+1 : posQuestion] } else { cfg.Database = dsn[posSecondSlash+1 : posQuestion] - cfg.Schema = "public" } done = true case dsn[i] == '?':