Python 3.8 Snowflake Connection Error : snowflake.connector.errors.OperationalError: 250003: 250003

Question:

Failed to get the response. Hanging? method: post, url: https://ABC.us-east-2.aws.snowflakecomputing.com:443/session/v1/login-request?request_id=efabf1c7-7fb6-48cb-a50e-256967e3de45&databaseName=DATAVAULT&schemaName=STAGE&warehouse=DATAVAULT&roleName=TEST_Admin&request_guid=c99547cd-ceeb-4280-845b-f2de7be76755

Getting connection error on Windows Python 3.8

Connection parameters

{
    "user" : "TestUser1",
    "password" : "XXXX",
    "account" : "ABC.us-east-2.aws",
    "warehouse" : "DATAVAULT",
    "database" : "DATAVAULT",
    "schema" : "STAGE",
    "Role" : "Test_role"
}

Also tried account name as "ABC", "ABC.aws" but didn’t work

Code:

    import snowflake.connector as snow

    conn = snow.connect(user=self.user,
      password= self.password,
      account= self.account,
      warehouse=self.warehouse,
          database=self.database,
      schema=self.schema,
      role=self.role
      )
    cur = conn.cursor()

The same code works fine from Linux but not with Windows version of Python.
Added proxy as below but didn’t help

os.environ['HTTP_PROXY'] = "http://http-proxy.company.com:80"
os.environ['HTTPS_PROXY'] = "https://http-proxy.company.com:443"

=====================================
Using sqlalchemy

import os 

os.environ['HTTP_PROXY'] = "http://http-proxy.xxx.com:80"
os.environ['HTTPS_PROXY'] = "https://https-proxy.xxx.com:443"

from sqlalchemy import create_engine
from snowflake.sqlalchemy import URL
import os
import sys



url = URL(
    account = 'xxxx.us-east-2.aws',
    user = 'TestUser1',
    database = 'DATAVAULT' ,
    schema = 'STAGE',
    warehouse= 'DATAVAULT',
    role = 'DV_Admin',
    password='xxxx', # note my passsword has a '@' in it 
)
print(os.environ['HTTP_PROXY'])
print(os.environ['HTTPS_PROXY'])


engine = create_engine(url)
print(engine)
results = engine.execute('select current_version()').fetchone()
sys.exit()
try:
    results = engine.execute('select current_version()').fetchone()
    assert results is not None
finally:
    engine.dispose()
Asked By: Marshall

||

Answers:

After fixing the Wifi proxy and Key chain file I am able to connect from my MAC.

Answered By: Marshall

Could you please let me know how this issue is been resolved. I am using the same code to connect to snowflake through proxy and i get the error below. any suggestions would helpful. Thanks

OperationalError: 250001: Could not connect to Snowflake backend after 0 attempt(s).Aborting

Answered By: JChouta