I’m trying to connect my streamlit application with some sql database that Snowflake owns. Clearly I have problems entering the data… can you help me?
The error is “ForbiddenError: 250001 (08001): Failed to connect to DB. Verify the account name is correct: ltb39995.snowflakecomputing.com:443. 000403: HTTP 403: Forbidden”
(bug to find the url?)
The secrets.toml (in folder .streamlit) is:
[connections.snowpark]
account = "(1)"
user = "(2)"
password = "(password)"
role = "ACCOUNTADMIN"
warehouse = "COMPUTE_SH"
database = "GLOBAL_DEFAULT_RISK_MONITOR"
schema = "DATA"
client_session_keep_alive = true
(1) Account, is ok? (“ltb39995”)

(2) Username, is it ok?

(3) The role and warehouse.

And the code of home page:
import streamlit as st
#import snowflake.connector as sf
import pandas as pd
# Initialize connection with experimental connection
conn = st.experimental_connection('snowpark')
# Read database
df = conn.query('select * from DATA.DEFAULT_PROBABILITY;', ttl=600)
# View results.
for row in df.itertuples():
st.write(pd.DataFrame(df))
I was looking for and applying various ways to make the connection work, but I can’t find the reason for the failure. I cant find error 
Thanks!
Hi @tinserrano
Thanks for your question. It seems in your secrets.toml
you’ve specified COMPUTE_SH
as the warehouse name, but from the screenshot it is COMPUTE_WH
In the last line of the code, could you try printing out values from the rows (currently you’ve specified df
). Please refer to the Streamlit Docs for example (e.g. st.write(f"{row.NAME} has a :{row.PET}:")
where NAME
and PET
are column names, thus please replace these with column names from your database.)
Hope this helps!
Best regards,
Chanin
Hello Chanin! It is a great pleasure to know that you answered me
Thanks for sharing the typo, but it continues with the same error… although now it tells me that it is an account problem. In Snowflake, do I have to put something somewhere so that it can read the SQL from outside? Thank you!
Error: ForbiddenError: 250001 (08001): Failed to connect to DB. Verify the account name is correct: ltb39995.snowflakecomputing.com:443. 000403: HTTP 403: Forbidden
Martin
Hi @tinserrano
My pleasure! I have contacted a colleague from the Snowflake side to help and will get back to you as soon as I get a solution to this issue.
Best regards,
Chanin
Hi @tinserrano!
Your Snowflake URL should have this syntax:
orgname-accountname.snowflakecomputing.com
An easy way to retrieve it would be to click Classic Console on your Snowflake UI and copying that link. Hope this helps!
2 Likes