[Python] 250001: Could not connect to Snowflake backend after 2 attempt(s).Aborting

Discussão em 'Python' iniciado por Stack, Fevereiro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to connect to snowflake using sql database and snowflake url but I am getting "Could not connect error".

    This is the code that I am using:

    from langchain import OpenAI, SQLDatabase
    from snowflake.snowpark import Session
    from langchain.chains import create_sql_query_chain


    snowflake_account = "XXXXX"
    username = "xxxx"
    password = "xxxxxxx"
    database= "eg_db"
    schema = "eg_sc"
    warehouse = "COMPUTE_WH"
    role = "ACCOUNTADMIN"

    snowflake_url = f"snowflake://{username}:{password}@{snowflake_account}/{database}/{schema}? warehouse={warehouse}&role={role}"

    db = SQLDatabase.from_uri(snowflake_url, sample_rows_in_table_info=1, include_tables=['table1','table2'])

    print(db.table_info)


    I checked my snowflake account and tried varies options like:

    orgname-accountname orgname-accountname.region.cloud(gcp) accountname.region.cloud(gcp) locator.region.cloud(gcp)

    Can someone help to resolve this error?

    Continue reading...

Compartilhe esta Página