3

I am working on a scenario where I will have to do some ETL-like operations in Python where the database is Snowflake. I am new to Python and after installing the pip for the Python and Snowflake connector, I am trying to run a simple code for doing a select * from a table. I added bits and pieces of code from various sources with a view to understand how the process works. I am getting the below error and unfortunately am not able to find anything conclusive online.

Error:

OperationalError: 250003: Failed to get the response. Hanging? method: post, url: https://nq13914.southeast-asia.snowflakecomputing.com:443/session/v1/login-request?request_id=7325eb5e-eec6-4ec9-976a-6dbd00852fc3&databaseName=util_db&schemaName=public&warehouse=compute_wh&request_guid=4674d312-5cfd-4944-a8db-7dda073b7b44

Code:

import snowflake.connector as sf
import pandas


ctx = sf.connect (
    user = 'floatinginthecloud89',
    password = '',
    account = 'nq13914.southeast-asia',
    warehouse = 'compute_wh',
    database = 'util_db',
    schema = 'public'
)
print("Got the context object")

cs = ctx.cursor()
print("Got the cursor object")


try:
    cs.execute("select * from util_db.public.qwerty1;")
    df = cs.fetch_pandas_all()
    df.info()
    print("__________")
    print(df.to_string())
finally:
    cs.close()     
ctx.close()     

2 Answers 2

1

Your code works for me with my own Snowflake account. Seems like your snowflake account (or the account that your company is using) is either wrong or has some Network Policy applied to it.

Using your browser, you should be able to go to https://nq13914.southeast-asia.snowflakecomputing.com/console/login#/ and see a login screen. In your case you cannot (nor can I) so the nq13914.southeast-asia is either wrong or being blocked.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the suggestion Simon. I added azure at the end of Asia. So the account name now looks like this --> account = 'nq13914.southeast-asia.azure',
Unfortunately, I am getting the error now --> Object 'UTIL_DB.PUBLIC.QWERTY1' does not exist or not authorized.
That's just a permissions issue. Make sure the table is accessible to the role you're using to log into Snowflake through python. show grants on table UTIL_DB.PUBLIC.QWERTY1
0

I was able to do run the script. Of the issues faced, the packages installed caused issues due to the version. So uninstalled and installed again. Had to do that a few times before it worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.