Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: set database name while database name is not empty (#15910)
h3n4le785bbcd0548
diff --git a/backend/plugin/db/snowflake/snowflake.go b/backend/plugin/db/snowflake/snowflake.goindex e01fbc78e1..abf0d39450 100644--- a/backend/plugin/db/snowflake/snowflake.go+++ b/backend/plugin/db/snowflake/snowflake.go@@ -73,10 +73,12 @@ func (d *Driver) Open(_ context.Context, dbType storepb.Engine, config db.Connec// buildSnowflakeDSN returns the Snowflake Golang DSN and a redacted version of the DSN.func buildSnowflakeDSN(config db.ConnectionConfig) (string, string, error) {snowConfig := &snow.Config{- Database: fmt.Sprintf(`"%s"`, config.ConnectionContext.DatabaseName),User: config.DataSource.Username,Password: config.Password,}+ if config.ConnectionContext.DatabaseName != "" {+ snowConfig.Database = fmt.Sprintf(`"%s"`, config.ConnectionContext.DatabaseName)+ }if config.DataSource.GetAuthenticationPrivateKey() != "" {rsaPrivKey, err := decodeRSAPrivateKey(config.DataSource.GetAuthenticationPrivateKey())if err != nil {diff --git a/backend/plugin/db/snowflake/snowflake_test.go b/backend/plugin/db/snowflake/snowflake_test.goindex 35025bf76a..2c3e3aef9d 100644--- a/backend/plugin/db/snowflake/snowflake_test.go+++ b/backend/plugin/db/snowflake/snowflake_test.go@@ -25,7 +25,7 @@ func TestBuildSnowflakeDSN(t *testing.T) {},Password: "pwd",},- want: "bytebase:[email protected]:443?database=%22%22&ocspFailOpen=true®ion=ap-southeast-1&validateDefaultParameters=true",+ want: "bytebase:[email protected]:443?ocspFailOpen=true®ion=ap-southeast-1&validateDefaultParameters=true",},{input: db.ConnectionConfig{@@ -52,7 +52,7 @@ func TestBuildSnowflakeDSN(t *testing.T) {},Password: "pwd",},- want: "bytebase:[email protected]:443?account=nb47110&database=%22%22&ocspFailOpen=true®ion=ap-southeast-1&validateDefaultParameters=true",+ want: "bytebase:[email protected]:443?account=nb47110&ocspFailOpen=true®ion=ap-southeast-1&validateDefaultParameters=true",},{input: db.ConnectionConfig{