Unable to connect to snowpark

Hey my app is not deploying to the cloud. I am using snowpark and it seems that the documentation changed since the introduction of st.experimental_connection

Is it still possible to connect to snowpark like before? I believe it was something like this

[snowflake]
account = ""
user = ""
password = ""
warehouse = ""
database = ""
schema = ""
from snowflake.snowpark import Session
import streamlit as st

@st.cache_resource(show_spinner=False)
def get_session():
    session = Session.builder.configs(**st.secrets.["snowflake"]).create()
    # session = Session.builder.configs(st.secrets.["snowflake"]).create() # Running this just shows the oh no error message
    return session

Am I doing something wrong here? Locally passing a connection_parameters dictionary to the session.builder works fine

This is the error im getting

configs() got an unexpected keyword argument 'account' snowpark

I also tried using the new st.experimental_connection like this

[connections.snowpark]
account = ""
user = ""
password = ""
role = ""
warehouse = ""
database = ""
schema = ""

Setting the session connection

session.py

import streamlit as st

conn = st.experimental_connection('snowpark')
session = conn.session

And using it in a streamlit page

pages/testing.py

from app_utils.session import session
import streamlit as st

st.write(session.sql('SELECT * FROM FACTCRIMES LIMIT 10').to_pandas())

But as soon as I go to that page the app says

Oh no. Error running app. If you need help, try the Streamlit docs and forums.

Edit: Link to the app

I managed to solve it. I was having issues with the dependencies but ran pipreqs to make sure all was added to requirements.txt

But this was the connection method I used

[snowflake]
account = ""
user = ""
password = ""
warehouse = ""
database = ""
schema = ""
from snowflake.snowpark import Session
import streamlit as st

@st.cache_resource(show_spinner=False)
def get_session():
    session = Session.builder.configs(st.secrets.["snowflake"]).create()
    return session

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