Skip to content

Commit 08877cc

Browse files
Update and clarify connections, especially Snowflake (#1175)
* Move Snowflake configuration examples * Add Snowflake landing page * Temporary streamlit.json * Revert "Temporary streamlit.json" This reverts commit ac6b641. * Update connection docs * Temporary streamlit.json * Move Snowflake configuration into docstring * Temporary streamlit.json * Update Snowflake connection tutorial * Remove copy pasta * Edit Snowflake tutorial * Edit SiS quickstart * Review edits * Update Snowsight screenshots * Copy SnowflakeConnection description and examples * Copy SQLConnection description and examples * Remove temporary 1.40.0 docstrings * Remove canary icon * Edit * Style edit * SPSC trial limitation
1 parent 7246208 commit 08877cc

29 files changed

+333
-264
lines changed

content/deploy/_index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Get all the information you need to deploy your app and share it with your users
1919
icon="cloud"
2020
bold="Streamlit Community Cloud."
2121
href="/deploy/streamlit-community-cloud"
22-
>Deploy your app on our free platform and join a community of developers who share their apps around the world.</InlineCallout>
22+
>Deploy your app on our free platform and join a community of developers who share their apps around the world. This is a great place for your non-commerical, personal, and educational apps.</InlineCallout>
2323
<InlineCallout
2424
color="lightBlue-70"
2525
icon="ac_unit"
26-
bold="Streamlit in Snowflake"
27-
href="https://docs.snowflake.com/developer-guide/streamlit/about-streamlit"
28-
>Deploy your app in Snowflake for a secure, enterprise-grade environment.</InlineCallout>
26+
bold="Snowflake."
27+
href="/deploy/snowflake"
28+
>Deploy your app in Snowflake for a secure, enterprise-grade environment. This is a great place for your business apps.</InlineCallout>
2929
<InlineCallout
3030
color="lightBlue-70"
3131
icon="bolt"

content/deploy/snowflake/_index.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Streamlit in Snowflake
3+
slug: /deploy/snowflake
4+
---
5+
6+
# Deploy Streamlit apps in Snowflake
7+
8+
Host your apps alongside your data in a single, global platform. Snowflake provides industry-leading features that ensure the highest levels of security for your account, users, data, and apps. If you're looking for an enterprise hosting solution, try Snowflake!
9+
10+
<TileContainer>
11+
<Tile
12+
icon="rocket_launch"
13+
title="Streamlit in Snowflake Quickstart"
14+
text="Create a free trial account and deploy an app with Streamlit in Snowflake."
15+
link="/get-started/installation/streamlit-in-snowflake"
16+
background="lightBlue-70"
17+
/>
18+
<Tile
19+
icon="code"
20+
title="Examples"
21+
text="Explore a plethora of example apps in Snowflake Labs' snowflake-demo-streamlit repository."
22+
link="https://github.com/Snowflake-Labs/snowflake-demo-streamlit"
23+
background="lightBlue-70"
24+
/>
25+
<Tile
26+
icon="book"
27+
title="Get started with Snowflake"
28+
text="Learn more in Snowflake's documentation."
29+
link="https://docs.snowflake.com/user-guide-getting-started"
30+
background="lightBlue-70"
31+
/>
32+
</TileContainer>
33+
34+
There are three ways to host Streamlit apps in Snowflake.
35+
36+
<InlineCalloutContainer>
37+
<InlineCallout
38+
color="lightBlue-70"
39+
icon="bolt"
40+
bold="Streamlit in Snowflake."
41+
href=""
42+
>Run your Streamlit app as a native object in Snowflake. Enjoy an in-browser editor and minimal work to configure your environment. Share your app with other users in your Snowflake account through role-based access control. This is a great way to deploy apps internally for your business. Check out Snowflake docs!</InlineCallout>
43+
<InlineCallout
44+
color="lightBlue-70"
45+
icon="ac_unit"
46+
bold="Snowflake Native Apps."
47+
href="https://docs.snowflake.com/en/developer-guide/native-apps/adding-streamlit"
48+
>Package your app with data and share it with other Snowflake accounts. This is a great way to share apps and their underlying data with other organizations who use Snowflake so they can run it in their own account. Check out Snowflake docs!</InlineCallout>
49+
<InlineCallout
50+
color="lightBlue-70"
51+
icon="web_asset"
52+
bold="Snowpark Container Services."
53+
href="https://docs.snowflake.com/en/developer-guide/snowpark-container-services/overview"
54+
>Deploy your app in a container that's optimized to run in Snowflake. This is the most flexible option where you can use any library. Share your app publicly or privately. Check out Snowflake docs!</InlineCallout>
55+
</InlineCalloutContainer>
56+
57+
<Note>
58+
59+
Using Snowpark Container Services to deploy a Streamlit app requires a compute pool, which is not available in a trial account at this time.
60+
61+
</Note>

content/develop/api-reference/connections/connections-snowflake.md

+1-40
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,12 @@ slug: /develop/api-reference/connections/st.connections.snowflakeconnection
55

66
<Tip>
77

8-
This page only contains the `st.connections.SnowflakeConnection` class. For a deeper dive into creating and managing data connections within Streamlit apps, read [Connecting to data](/develop/concepts/connections/connecting-to-data).
8+
This page only contains the `st.connections.SnowflakeConnection` class. For a deeper dive into creating and managing data connections within Streamlit apps, see [Connect Streamlit to Snowflake](/develop/tutorials/databases/snowflake) and [Connecting to data](/develop/concepts/connections/connecting-to-data).
99

1010
</Tip>
1111

1212
<Autofunction function="streamlit.connections.SnowflakeConnection" />
1313

14-
### Configuration
15-
16-
{/**
17-
Internal note: This section is deep-linked from the library in 1.28.1 via /st.connections.snowflakeconnection-configuration through a redirect.
18-
Maintain the redirect if moved or modified.
19-
**/}
20-
21-
`st.connection("snowflake")` can be configured using [Streamlit secrets](/develop/concepts/connections/secrets-management) or keyword args just like any other connection. It can also use existing Snowflake connection configuration when available.
22-
23-
Note that [snowflake-snowpark-python](https://pypi.org/project/snowflake-snowpark-python/) must be installed to use this connection.
24-
25-
#### Using Streamlit secrets
26-
27-
For example, if your Snowflake account supports SSO, you can set up a quick local connection for development using [browser-based SSO](https://docs.snowflake.com/en/user-guide/admin-security-fed-auth-use#how-browser-based-sso-works) and `secrets.toml` as follows:
28-
29-
```toml
30-
# .streamlit/secrets.toml
31-
32-
[connections.snowflake]
33-
account = "<ACCOUNT ID>"
34-
user = "<USERNAME>"
35-
authenticator = "EXTERNALBROWSER"
36-
```
37-
38-
Learn more about [account indentifier here](https://docs.snowflake.com/en/user-guide/admin-account-identifier). You could also specify the full configuration and credentials in your secrets file, as in the [example here](/develop/tutorials/databases/snowflake#add-connection-parameters-to-your-local-app-secrets).
39-
40-
#### Using existing Snowflake configuration
41-
42-
Snowflake's python driver also supports a [connection configuration file](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#connecting-using-the-connections-toml-file), which is well integrated with Streamlit `SnowflakeConnection`. If you already have one or more connections configured, all you need to do is pass Streamlit the name of the connection to use. This can be done in several ways:
43-
44-
- Set `connection_name` in your app code, such as `st.connnection("<name>", type="snowflake")`.
45-
- Set `connection_name = "<name>"` in the `[connections.snowflake]` section of your Streamlit secrets.
46-
- Set the environment variable `SNOWFLAKE_DEFAULT_CONNECTION_NAME=<name>`.
47-
- [Set a default connection](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#setting-a-default-connection) in your Snowflake configuration.
48-
49-
When available in [Streamlit in Snowflake](https://docs.snowflake.com/en/developer-guide/streamlit/about-streamlit), `st.connection("snowflake")` will connect automatically using the [app owner role](https://docs.snowflake.com/en/developer-guide/streamlit/owners-rights) and does not require any configuration.
50-
51-
Learn more about setting up connections in the [Connecting Streamlit to Snowflake tutorial](/develop/tutorials/databases/snowflake) and [Connecting to data](/develop/concepts/connections/connecting-to-data).
52-
5314
<Autofunction function="streamlit.connections.SnowflakeConnection.cursor" />
5415

5516
<Autofunction function="streamlit.connections.SnowflakeConnection.query" />

content/develop/api-reference/connections/connections-snowpark.md

-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ title: st.connections.SnowparkConnection
33
slug: /develop/api-reference/connections/st.connections.snowparkconnection
44
---
55

6-
<Important>
7-
8-
This is an experimental feature. Experimental features and their APIs may change or be removed at any time. To learn more, click [here](/develop/quick-reference/prerelease#experimental-features).
9-
10-
</Important>
11-
126
<Tip>
137

148
This page only contains the `st.connections.SnowparkConnection` class. For a deeper dive into creating and managing data connections within Streamlit apps, read [Connecting to data](/develop/concepts/connections/connecting-to-data).

content/develop/api-reference/connections/connections-sql.md

-52
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,6 @@ This page only contains the `st.connections.SQLConnection` class. For a deeper d
1111

1212
<Autofunction function="streamlit.connections.SQLConnection" />
1313

14-
### Basic usage:
15-
16-
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) and any required drivers must be installed to use this connection.
17-
18-
```python
19-
import streamlit as st
20-
21-
conn = st.connection("sql")
22-
df = conn.query("select * from pet_owners")
23-
st.dataframe(df)
24-
```
25-
26-
In case you want to pass a connection URL (or other parameters) directly, it also works:
27-
28-
```python
29-
conn = st.connection(
30-
"local_db",
31-
type="sql",
32-
url="mysql://user:pass@localhost:3306/mydb"
33-
)
34-
```
35-
36-
Or specify parameters in [secrets](/develop/concepts/connections/secrets-management):
37-
38-
```toml
39-
# .streamlit/secrets.toml
40-
[connections.mydb]
41-
dialect = "mysql"
42-
username = "myuser"
43-
password = "password"
44-
host = "localhost"
45-
database = "mydb"
46-
```
47-
48-
```python
49-
# streamlit_app.py
50-
conn = st.connection("mydb", type="sql", autocommit=True)
51-
```
52-
53-
As described above, some cloud databases use extra `**kwargs` to specify credentials. These can be passed via secrets using the `create_engine_kwargs` section:
54-
55-
```toml
56-
# .streamlit/secrets.toml
57-
[connections.snowflake]
58-
url = "snowflake://<username>@<account>/"
59-
60-
[connections.snowflake.create_engine_kwargs.connect_args]
61-
authenticator = "externalbrowser"
62-
role = "..."
63-
# ...
64-
```
65-
6614
<Autofunction function="streamlit.connections.SQLConnection.connect" />
6715

6816
<Autofunction function="streamlit.connections.SQLConnection.query" />

content/develop/tutorials/databases/neon.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This guide explains how to securely access a [Neon database](https://neon.tech/)
2828

2929
## Create a Neon project
3030

31-
If you already have a Neon project that you want to use, feel free to [skip to the next step](#add-neon-connection-string-to-your-local-app-secrets).
31+
If you already have a Neon project that you want to use, you can [skip to the next step](#add-neon-connection-string-to-your-local-app-secrets).
3232

3333
1. Log in to the Neon console and navigate to the [Projects](https://console.neon.tech/app/projects) section.
3434
1. If you see a prompt to enter your project name, skip to the next step. Otherwise, click the "**New Project**" button to create a new project.

content/develop/tutorials/databases/private-gsheet.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This tutorial requires `streamlit>=1.28` and `st-gsheets-connection` in your Pyt
1717

1818
## Create a Google Sheet
1919

20-
If you already have a Sheet that you want to use, feel free to [skip to the next step](#enable-the-sheets-api).
20+
If you already have a Sheet that you want to use, you can [skip to the next step](#enable-the-sheets-api).
2121

2222
Create a spreadsheet with this example data.
2323

content/develop/tutorials/databases/public-gsheet.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This tutorial requires `streamlit>=1.28` and `st-gsheets-connection` in your Pyt
1717

1818
## Create a Google Sheet and turn on link sharing
1919

20-
If you already have a Sheet that you want to access, feel free to [skip to the next step](#add-the-sheets-url-to-your-local-app-secrets). See Google's documentation on how to [share spreadsheets](https://support.google.com/docs/answer/9331169?hl=en#6.1) for more information.
20+
If you already have a Sheet that you want to access, you can [skip to the next step](#add-the-sheets-url-to-your-local-app-secrets). See Google's documentation on how to [share spreadsheets](https://support.google.com/docs/answer/9331169?hl=en#6.1) for more information.
2121

2222
Create a spreadsheet with this example data and create a share link. The link should have "Anyone with the link" set as a "Viewer."
2323

0 commit comments

Comments
 (0)