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
Manmeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.