Skip to content

Commit

Permalink
fix: avoid setting default connection options as password for snowflake
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr committed Feb 28, 2025
1 parent 886ab32 commit c378611
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions sqlconnect/internal/snowflake/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,19 @@ type Config struct {

func (c Config) ConnectionString() (dsn string, err error) {
sc := gosnowflake.Config{
Authenticator: gosnowflake.AuthTypeSnowflake,
User: c.User,
Password: c.Password,
Account: c.Account,
Database: c.DBName,
Warehouse: c.Warehouse,
Schema: c.Schema,
Role: c.Role,
Region: c.Region,
Protocol: c.Protocol,
Host: c.Host,
Port: c.Port,
Application: c.Application,
LoginTimeout: c.LoginTimeout,
Params: make(map[string]*string),
User: c.User,
Account: c.Account,
Database: c.DBName,
Warehouse: c.Warehouse,
Schema: c.Schema,
Role: c.Role,
Region: c.Region,
Protocol: c.Protocol,
Host: c.Host,
Port: c.Port,
Application: c.Application,
LoginTimeout: c.LoginTimeout,
Params: make(map[string]*string),
}

if c.UseKeyPairAuth {
Expand All @@ -73,6 +71,9 @@ func (c Config) ConnectionString() (dsn string, err error) {
} else if c.UseOAuth {
sc.Authenticator = gosnowflake.AuthTypeOAuth
sc.Token = c.OAuthToken
} else {
sc.Authenticator = gosnowflake.AuthTypeSnowflake
sc.Password = c.Password
}

if c.KeepSessionAlive {
Expand Down

0 comments on commit c378611

Please sign in to comment.