简体   繁体   中英

Snowflake - Connector issue with Python

I tried to connect Snowflake using python connector snowflake.connector .

error:

snowflake.connector.errors.OperationalError: 250003: Failed to get the response. Hanging? method: post, url: https://efa44011.snowflakecomputing.com:443/session/v1/login-request?request_id=306f23d5-8367-4f0c-a2ff-eebeaddc60d2&databaseName=SNOWFLAKE_SAMPLE_DATA&schemaName=TPCH_SF1000&warehouse=COMPUTE_WH&request_guid=1f40e88e-610b-430a-adb5-52c8baed6dbc

Complete Code:

import snowflake.connector
print("Connecting...")
con = snowflake.connector.connect(
    user='XXXXXXXX',
    password='XXXXXXX',
    account = 'efa44011',
    warehouse = 'COMPUTE_WH',
    database = 'SNOWFLAKE_SAMPLE_DATA',
    schema = 'TPCH_SF1000'
    )



con.cursor().execute("USE WAREHOUSE " +'COMPUTE_WH')
con.cursor().execute("USE DATABASE " + 'SNOWFLAKE_SAMPLE_DATA')

cs = con.cursor()
try:
    cs.execute("SELECT current_version()")
    one_row = cs.fetchone()
    print(one_row[0])
finally:
    cs.close()
con.close()

Thanks in advance

It might be the case that your account parameter is not correct.

Account information typically has the following structure depending on the region and cloud platform where your account is hosted:

account
account.region_id
account.region_id.platform

For example:

efa44011
efa44011.us-east-1
efa44011.east-us-2.azure

Could you please check the account URL appeared in the error is correct: https://efa44011.snowflakecomputing.com:443

If not you have mention the incorrect account name in connection parameters.

Hope this might help!

I checked the account and confirmed that efa44011.snowflakecomputing.com is correct, so you are using the correct account params. What sort of host are you running python on? Your desktop, maybe an ec2 instance?

Can you try from a command prompt to see if the following works?

curl -k -v https://efa44011.snowflakecomputing.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM