Operational Error

Hi there,

I’m working on snowflake badge 2 and when I’m running a query to trial metadata, this is the error I’m constantly getting.
i have deleted the app multiple times and recreated everything from an another account and even created a new github and streamlit account

i have even rebooted the app multiple times.

import.snowflake.connector

Added secrets in app (with my details)

[snowflake]
user = “xxx”
password = “xxx”
account = “acctlocator.region.cloud” <–Replace this with your Account Locator, etc - and delete this comment
warehouse = “pc_rivery_wh”
database = “pc_rivery_db”
schema = “public”
role = “pc_rivery_role”

then ran this syntax

my_cnx = snowflake.connector.connect(**streamlit.secrets[“snowflake”])
my_cur = my_cnx.cursor()
my_cur.execute(“SELECT CURRENT_USER(), CURRENT_ACCOUNT(), CURRENT_REGION()”)
my_data_row = my_cur.fetchone()
streamlit.text(“Hello from Snowflake:”)
streamlit.text(my_data_row)

and when I run this, the below error pops up

snowflake.connector.errors.OperationalError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).
Traceback:
File “/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 552, in _run_script
exec(code, module.dict)
File “/mount/src/first_streamlit_app/streamlit_app.py”, line 36, in
my_cnx = snowflake.connector.connect(**streamlit.secrets[“snowflake”])
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/init.py”, line 51, in Connect
return SnowflakeConnection(**kwargs)
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py”, line 351, in init
self.connect(**kwargs)
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py”, line 623, in connect
self.__open_connection()
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py”, line 896, in __open_connection
self.authenticate_with_retry(self.auth_class)
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py”, line 1165, in authenticate_with_retry
self._authenticate(auth_instance)
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py”, line 1236, in _authenticate
raise auth_op from e
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py”, line 1213, in _authenticate
auth_instance.handle_timeout(
File “/home/adminuser/venv/lib/python3.9/site-packages/snowflake/connector/auth/by_plugin.py”, line 219, in handle_timeout
raise error

I’m not able to find any solutions for this and any help in the regard is much appreciated.
thanks in advance

Hi @deenuthakki,

Welcome to our community! :wave:

The error you’re encountering, OperationalError, occurs when there’s an issue with establishing a connection to the Snowflake database.

Have you checked that the connection details you’ve provided, such as user, password, account, warehouse, database, schema, and role, are correct?

Thanks,
Charly

Thank you very much for your response, Charly.

These are the details I have entered

[snowflake]
user = “deeptinuthakki”
password = “********”
account = “aa0000.ap-southeast-2.aws” (my acct locator)
warehouse = “pc_rivery_wh”
database = “pc_rivery_db”
schema = “public”
role = “pc_rivery_role”

I have changed the role to account admin and also tried with just the account locator to see if it would work but I keep getting the same error.

The requirements file has below information.

requirements.txt

snowflake-connector-python

where am I going wrong?

Regards
Dee

It worked when I changed account name from ‘account locator’ to ‘login id’ that was provided in the snowflake sign in mail but just once and changed into operational error.

  • account = “csdejku-qq0000.ap-southeast-2.aws”
2 Likes

Glad to know it worked! :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.