Skip to content

Commit fcf339b

Browse files
committed
SNOW-27094: add region option to connect so that the client can specify Snowflake database region.
1 parent cc93546 commit fcf339b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

connection.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
u'database': None, # standard
4949
u'protocol': u'http', # support http/https
5050
u'warehouse': None, # snowflake
51+
u'region': None, # snowflake
5152
u'account': None, # snowflake
5253
u'schema': None, # snowflake
5354
u'role': None, # snowflake
@@ -144,6 +145,13 @@ def port(self):
144145
"""
145146
return self._port
146147

148+
@property
149+
def region(self):
150+
u"""
151+
Region name if not the default Snowflake Database deployment
152+
"""
153+
return self._region
154+
147155
@property
148156
def proxy_host(self):
149157
u"""
@@ -469,8 +477,13 @@ def __config(self, **kwargs):
469477

470478
if u'account' in kwargs and kwargs[u'account'] not in TEST_ACCOUNTS:
471479
if u'host' not in kwargs:
472-
setattr(self, u'_host',
473-
self._account + u'.snowflakecomputing.com')
480+
if kwargs.get(u'region'):
481+
host = u'{0}.{1}.snowflakecomputing.com'.format(
482+
self._account[0:self._account.find(u'.')],
483+
kwargs.get(u'region'))
484+
else:
485+
host = u'{0}.snowflakecomputing.com'.format(self._account)
486+
setattr(self, u'_host', host)
474487
if u'port' not in kwargs:
475488
setattr(self, u'_port', u'443')
476489
if u'protocol' not in kwargs:

0 commit comments

Comments
 (0)