Skip to content

Commit 64a5cf3

Browse files
smtakedaankit-bhatnagar167
authored andcommitted
SNOW-54514: Support region=us-west-2 connection.
1 parent 12ec1c4 commit 64a5cf3

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

test/test_connection.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,17 @@ def test_invalid_proxy(db_parameters):
453453

454454
@pytest.mark.timeout(15)
455455
def test_eu_connection(tmpdir):
456+
"""
457+
If region is specified to eu-central-1, the URL will become
458+
https://testaccount1234.eu-central-1.snowflakecomputing.com/
459+
NOTE: region is deprecated.
460+
"""
456461
import os
457462
os.environ["SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED"] = "true"
458463
with pytest.raises(ForbiddenError):
459464
# must reach Snowflake
460465
snowflake.connector.connect(
461-
account='testaccount',
466+
account='testaccount1234',
462467
user='testuser',
463468
password='testpassword',
464469
region='eu-central-1',
@@ -468,6 +473,24 @@ def test_eu_connection(tmpdir):
468473
)
469474

470475

476+
@pytest.mark.timeout(15)
477+
def test_us_west_connection(tmpdir):
478+
"""
479+
region='us-west-2' indicates no region is included in the hostname, i.e.,
480+
https://testaccount1234.snowflakecomputing.com.
481+
NOTE: region is deprecated.
482+
"""
483+
with pytest.raises(ForbiddenError):
484+
# must reach Snowflake
485+
snowflake.connector.connect(
486+
account='testaccount1234',
487+
user='testuser',
488+
password='testpassword',
489+
region='us-west-2',
490+
login_timeout=5,
491+
)
492+
493+
471494
@pytest.mark.timeout(15)
472495
def test_privatelink(db_parameters):
473496
"""

util_text.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def split_statements(buf, remove_comments=False):
7373
col += 2
7474
elif line[col] == ch_quote:
7575
if col < len_line - 1 and line[col + 1] != ch_quote or \
76-
col == len_line - 1:
76+
col == len_line - 1:
7777
# exits quote
7878
in_quote = False
7979
statement.append((line[col0:col + 1], True))
@@ -191,6 +191,8 @@ def construct_hostname(region, account):
191191
"""
192192
Constructs hostname from region and account
193193
"""
194+
if region == u'us-west-2':
195+
region = ''
194196
if region:
195197
if account.find(u'.') > 0:
196198
account = account[0:account.find(u'.')]

0 commit comments

Comments
 (0)