Experimental_connection issue

I really like experimental_connection, so I don’t have to use Snowpark session, but unfortunately, it’s not working for me. I have simple query, which successfully connects to the server, but the result fails on

SnowparkFetchDataException: (1406): Failed to fetch a Pandas Dataframe. The error is: to_pandas() did not return a Pandas DataFrame. If you use session.sql(…).to_pandas()

import streamlit as st

from snowflake.snowpark.session import Session

conn = st.experimental_connection("snowpark")

df = conn.query("select 1")

st.write(df)

I’m using VSC, if it helps. The same approach works with Snowflake session.

Hi @OddJelly,

Thanks for posting!

Try adding to_pandas() in the df variable:

df = conn.query("select 1").to_pandas()

If that doesn’t work, can you please share a template of your secrets.toml file with the secrets masked?

Hi @tonykip,
thank you for helping!
Yes. I tried, unfortunately the same error.

Secret file:

# .streamlit_sec/secrets.toml

OPENAI_API_KEY = ""
REPLICATE_API_TOKEN = ""

[connections.snowpark]
authenticator = "externalbrowser"
account = "***"
user = "***"
role = "***"
database = "PROD_COMEX_ML_DB"
schema = "PUBLISH"
warehouse = "CSS_ANALYTICS_WH"

Hi @OddJelly, could you share your pyarrow version?
I was unable to duplicate the issue with
streamlit==1.24.1
pyarrow==10.0.1
snowflake-snowpark-python==1.5.1

Hi @mliu,
Forced update to pyarrow==10.0.1 worked!

Thank you very much!

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