How to connect Streamlit to Snowflake if user connects to Snowflake using AzureAD no username or password

I am trying to use Streamlit which comes with Snowflake. connecting to Snowflake database is by using AzureAD. no username or password used when logging to database. how to have Streamlit which comes with Snowflake connects to snowflake database?

Hi @ahmadbahr, and welcome to our forums! :wave:

Connecting Streamlit to Snowflake using AzureAD auth involves using the Snowflake Python connector and the appropriate auth parameters.

You need to install the snowflake-connector-python and streamlit packages, set up Snowflake for AzureAD authentication, use the Snowflake Python connector with the Azure Tenant ID for authentication.

Here’s a helpful tutorial on that topic: Connect Streamlit to Snowflake - Streamlit Docs

Best of luck, and feel free to reach out if you have further questions!

Charly

Thanks Charly,
I think I was not clear enough. I have access to Snowflake and Streamlit. I have no local install. we access snowflake through URL for our accounts directly through Snowflake. what I was looking for is how to have that Streamlit which comes inside Snowflake “Suite” talk to Snowflake database. when I open streamlit, I see installed packages info as Python 3.8*, snowflake-snowpark (latest) and streamlit 1.22.0
Is that helpful

Thanks

I’m sorry, but just to make sure I’m understanding the questions, can you please elaborate on the following:

what I was looking for is how to have that Streamlit which comes inside Snowflake “Suite” talk to Snowflake database

Thanks,
Charly

Hi Charly,

In my work, we can access Streamlit through Snowflake. The screenshot below partially shows streamlit as one of the icons to the left. If I click on it, it opens the installed Streamlit provided by Snowflake for that account. I want to know how to have that Streamlit talk to Snowflake database.
Is the below screenshot clear?

Let me check with the Devs - Thanks for your patience!

Charly

if it helps, here are the installed versions when I go to a sample app that I created.
Thanks

image

1 Like

Thanks @ahmadbahr.

Here’s the feedback from the Devs:

They should see that exact app if they create a new streamlit app, and it should show session, how you can get access to it. Once you have a session, you can just do normal Snowpark, such as: Working with DataFrames in Snowpark Python | Snowflake Documentation

Or you can use session.sql to use SQL queries Working with DataFrames in Snowpark Python | Snowflake Documentation

Does this help you?

Best,
Charly

Thanks Charly,
not 100% following, but I’ll give it a try and come back with question if I need.
Thanks again