Commit 7d34091 1 parent 45b3d45 commit 7d34091 Copy full SHA for 7d34091
File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,16 @@ func (c *Config) ocspMode() string {
141
141
142
142
// DSN constructs a DSN for Snowflake db.
143
143
func DSN (cfg * Config ) (dsn string , err error ) {
144
- if cfg .Region == "us-west-2" {
144
+ if strings . ToLower ( cfg .Region ) == "us-west-2" {
145
145
cfg .Region = ""
146
146
}
147
147
// in case account includes region
148
148
region , posDot := extractRegionFromAccount (cfg .Account )
149
+ if strings .ToLower (region ) == "us-west-2" {
150
+ region = ""
151
+ cfg .Account = cfg .Account [:posDot ]
152
+ logger .Info ("Ignoring default region .us-west-2 in DSN from Account configuration." )
153
+ }
149
154
if region != "" {
150
155
if cfg .Region != "" {
151
156
return "" , errRegionConflict ()
@@ -587,6 +592,11 @@ func transformAccountToHost(cfg *Config) (err error) {
587
592
// account name is specified instead of host:port
588
593
cfg .Account = cfg .Host
589
594
region , posDot := extractRegionFromAccount (cfg .Account )
595
+ if strings .ToLower (region ) == "us-west-2" {
596
+ region = ""
597
+ cfg .Account = cfg .Account [:posDot ]
598
+ logger .Info ("Ignoring default region .us-west-2 from Account configuration." )
599
+ }
590
600
if region != "" {
591
601
cfg .Region = region
592
602
cfg .Account = cfg .Account [:posDot ]
Original file line number Diff line number Diff line change @@ -1297,6 +1297,22 @@ func TestDSN(t *testing.T) {
1297
1297
},
1298
1298
dsn :
"u:[email protected] :443?account=account-name&ocspFailOpen=true®ion=cn-region&validateDefaultParameters=true" ,
1299
1299
},
1300
+ {
1301
+ cfg : & Config {
1302
+ User : "u" ,
1303
+ Password : "p" ,
1304
+ Account : "account.us-west-2" ,
1305
+ },
1306
+ dsn :
"u:[email protected] :443?ocspFailOpen=true&validateDefaultParameters=true" ,
1307
+ },
1308
+ {
1309
+ cfg : & Config {
1310
+ User : "u" ,
1311
+ Password : "p" ,
1312
+ Account : "account_us-west-2" ,
1313
+ },
1314
+ dsn : "u:p@account_us-west-2.snowflakecomputing.com:443?ocspFailOpen=true&validateDefaultParameters=true" ,
1315
+ },
1300
1316
{
1301
1317
cfg : & Config {
1302
1318
User : "u" ,
You can’t perform that action at this time.
0 commit comments