0
votes

I am trying to run a small piece of code to connect snowflake via python but I get the following error, I saw few documentations from the snowflake community but the answers don't seem to be convincing because it did not do much help. I will paste my code here, please let me know how you can help on this issue.

Code:

import snowflake.connector

conn = snowflake.connector.connect(user='domainname\username',password=password,account='account.region.snowflakecomputing.com',warehouse='dpt',database='dpt_test2',schema='qa')

cur = conn.cursor()

cur.execute("select * from customer")

print (cur.fetchone()[0])

conn.close()

Error:

snowflake.connector.errors.OperationalError: 250003: Failed to execute request: HTTPSConnectionPool(host='account.region.snowflakecomputing.com.snowflakecomputing.com', port=443): Max retries exceeded with url: /session/v1/login-request?request_id=01252974-4a6c-4534-88ee-a07a7d210c88&databaseName=ecs_dpt_test2&schemaName=qa&warehouse=ecs_dpt_l&request_guid=3f11ba57-71f4-4ce2-8252-c64e3f8e10 f0 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

in case I remove snowflake.computing.com from the account parameter I get an incorrect user name and password.

1
I see "snowflakecomputing.com" repeated twice in the error so I don't think your need that piece in the account parameter or else the URL will not resolve. Then we can look at the incorrect username/password error. Are you putting just the username from Snowflake in the user parameter or trying to do something else here?Suzy Lockwood
I removed the snowflakecomputing.com from the piece of code and I reran the code but I still get an incorrect user name or password. I'm just putting the snowflake username='Domain\user' and password =password in the parameters.Ajay Mathews
What do you mean by domain? If you have the default username/password authentication in Snowflake, you should only have to enter your username. For example, if your username is AJAY in Snowflake, that is the value you would enter here. Also, do you have a proxy server and does it require authentication? If so, you can configure the proxy variables and any authentication credentials. docs.snowflake.com/en/user-guide/…Suzy Lockwood

1 Answers

0
votes

Error thrown is 403 which means Proxy was configured incorrectly or the authentication to the proxy was not passed correctly.

Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'

You can follow below link to diagnose further. Also in account it does not expect snowflake.computing.com. Only account name should be passed.

https://docs.snowflake.com/en/user-guide/snowcd.html