NameError

Hi Everyone, New to Streamlit. Can you please help me solve the following problem with the NameError?
thanks,
Ron
If you’re creating a debugging post, please include the following info:

  1. Share the link to the public app (deployed on Community Cloud).
  2. Share the link to your app’s public GitHub repository (including a requirements file).
  3. Share the full text of the error message (not a screenshot).
  4. NameError: 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 "/mount/src/rg_tech_llm_rag/streamlit_app.py", line 20, in <module>
    svc = root.databases[CORTEX_SEARCH_DATABASE].schemas[CORTEX_SEARCH_SCHEMA].cortex_search_services[CORTEX_SEARCH_SERVICE]
  1. Share the Streamlit and Python versions.
  2. python 3.9
  3. service parameters

CORTEX_SEARCH_DATABASE = “RG_SEARCH_DOCS”
CORTEX_SEARCH_SCHEMA = “DATA”
CORTEX_SEARCH_SERVICE = “RG_SEARCH_SERVICE_CS”
svc = root.databases[CORTEX_SEARCH_DATABASE].schemas[CORTEX_SEARCH_SCHEMA].cortex_search_services[CORTEX_SEARCH_SERVICE]
#session = get_active_session()
#root = Root(session)
#added this for
cnx = st.connection(“snowflake”)
session = cnx.session()

Take a look at the full error details recorded in the logs. Looks like you forgot to define root.

Thank you Goyo, Arghhh… You are right. i had it out of order. Thanks, Ron
this fixed it.
cnx = st.connection(“snowflake”)
session = cnx.session()
root = Root(session)