Hi All,
I am not able to connect with Snowflake form Streamlit script on the following url:
Error Message: ForbiddenError: 250001 (08001): None: Failed to connect to DB. Verify the account name is correct: RL82382.snowflakecomputing.com:443. 000403: 403: HTTP 403: Forbidden
More Info:
a) streamlit run /Users/abu/Documents/AI_Software/Streamlit_Riaz_Resume_Neo/Snowflake_Streamlit/app.py [ARGUMENTS]
2023-02-06 11:15:23.390 Snowflake Connector for Python Version: 3.0.0, Python Version: 3.9.13, Platform: macOS-11.3.1-x86_64-i386-64bit
2023-02-06 11:15:23.390 This connection is in OCSP Fail Open Mode. TLS Certificates would be checked for validity and revocation status. Any other Certificate Revocation related exceptions or OCSP Responder failures would be disregarded in favor of connectivity.
2023-02-06 11:15:23.390 Setting use_openssl_only mode to False
b) From Debug Window:
More information from Debug window:
exception = {tuple: 3} (<class âsnowflake.connector.errors.ForbiddenErrorâ>, 250001 (08001): None: Failed to connect to DB. Verify the account name is correct: RL82382.snowflakecomputing.com:443. 000403: 403: HTTP 403: Forbidden, <traceback object at 0x11be50300>)
account = {str} âRL82382â
auth_instance = {AuthByDefault} <snowflake.connector.auth.default.AuthByDefault object at 0x11b91d820>
auth_timeout = {int} 120
body = {dict: 1} {âdataâ: {âCLIENT_APP_IDâ: âPythonConnectorâ, âCLIENT_APP_VERSIONâ: â3.0.0â, âSVN_REVISIONâ: None, âACCOUNT_NAMEâ: âRL82382â, âLOGIN_NAMEâ: âriazahmedâ, âCLIENT_ENVIRONMENTâ: {âAPPLICATIONâ: âstreamlitâ, âOSâ: âDarwinâ, âOS_VERSIONâ: 'macOS-11.3.1-x86_64-i
body_template = {dict: 1} {âdataâ: {âCLIENT_APP_IDâ: âPythonConnectorâ, âCLIENT_APP_VERSIONâ: â3.0.0â, âSVN_REVISIONâ: None, âACCOUNT_NAMEâ: âRL82382â, âLOGIN_NAMEâ: âriazahmedâ, âCLIENT_ENVIRONMENTâ: {âAPPLICATIONâ: âstreamlitâ, âOSâ: âDarwinâ, âOS_VERSIONâ: 'macOS-11.3.1-x86_64-i
database = {str} âPETSâ
headers = {dict: 4} {âContent-Typeâ: âapplication/jsonâ, âacceptâ: âapplication/snowflakeâ, âUser-Agentâ: âPythonConnector/3.0.0 (macOS-11.3.1-x86_64-i386-64bit) CPython/3.9.13â, âContent-Encodingâ: âgzipâ}
mfa_callback = {NoneType} None
passcode = {NoneType} None
passcode_in_password = {bool} False
password_callback = {NoneType} None
request_id = {str} â1c9074c9-0c20-4dd6-baea-7d5bb509619bâ
role = {NoneType} None
schema = {str} âPUBLICâ
self = {Auth} <snowflake.connector.auth._auth.Auth object at 0x11b91d940>
session_parameters = {dict: 2} {âCLIENT_SESSION_KEEP_ALIVEâ: True, âCLIENT_PREFETCH_THREADSâ: 4}
timeout = {int} 120
url = {str} â/session/v1/login-request?request_id=1c9074c9-0c20-4dd6-baea-7d5bb509619b&databaseName=PETS&schemaName=PUBLIC&warehouse=COMPUTE_WHâ
url_parameters = {dict: 4} {ârequest_idâ: â1c9074c9-0c20-4dd6-baea-7d5bb509619bâ, âdatabaseNameâ: âPETSâ, âschemaNameâ: âPUBLICâ, âwarehouseâ: âCOMPUTE_WHâ}
user = {str} âriazahmedâ
warehouse = {str} âCOMPUTE_WHâ
c) // secrets.toml
- [snowflake]
- user = âmyuserâ â Not actual user
- password = âmypasswordâ. â Not actual password
- account = âRL12345â â Not actual account
- warehouse = âCOMPUTE_WHâ
- database = âPETSâ
- schema = âPUBLICâ
d) app.py coe:
- import streamlit as st
- import snowflake.connector
-
Uses st.experimental_singleton to only run once.
- @st.experimental_singleton
- def init_connection():
- return snowflake.connector.connect(
- **st.secrets[âsnowflakeâ], client_session_keep_alive=True
- )
-
Uses st.experimental_memo to only rerun when the query changes or after 10 min.
- @st.experimental_memo(ttl=600)
- def run_query(query):
- with conn.cursor() as cur:
- cur.execute(query)
- return cur.fetchall()
- for row in rows:
- st.write(f"{row[0]} has a :{row[1]}:")
I will appreciate help to resolve this issue blocking me.
Regards, Riaz