diff --git a/content/deploy/snowflake/_index.md b/content/deploy/snowflake/_index.md index 096684ecc..2c5d77717 100644 --- a/content/deploy/snowflake/_index.md +++ b/content/deploy/snowflake/_index.md @@ -18,7 +18,7 @@ Host your apps alongside your data in a single, global platform. Snowflake provi @@ -31,7 +31,7 @@ Host your apps alongside your data in a single, global platform. Snowflake provi /> -There are three ways to host Streamlit apps in Snowflake. +There are three ways to host Streamlit apps in Snowflake: 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! + >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 (RBAC). This is a great way to deploy apps internally for your business. Check out Snowflake docs! 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! + >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. Check out Snowflake docs! 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! + >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 and assign a public URL to your app. Manage your allowed viewers through your Snowflake account. Check out Snowflake docs! diff --git a/content/develop/tutorials/databases/snowflake.md b/content/develop/tutorials/databases/snowflake.md index df0f1e766..9d88323cf 100644 --- a/content/develop/tutorials/databases/snowflake.md +++ b/content/develop/tutorials/databases/snowflake.md @@ -7,7 +7,7 @@ slug: /develop/tutorials/databases/snowflake ## Introduction -This guide explains how to securely access a Snowflake database from Streamlit. It uses [st.connection](/develop/api-reference/connections/st.connection), the [Snowpark library](https://docs.snowflake.com/en/developer-guide/snowpark/python/index) and Streamlit's [Secrets management](/develop/concepts/connections/secrets-management). +This guide explains how to securely access a Snowflake database from Streamlit. It uses [st.connection](/develop/api-reference/connections/st.connection), the [Snowpark library](https://docs.snowflake.com/en/developer-guide/snowpark/python/index), and Streamlit's [Secrets management](/develop/concepts/connections/secrets-management). ### Prerequisites @@ -20,7 +20,7 @@ This guide explains how to securely access a Snowflake database from Streamlit. ``` - Use the correct version of Python required by `snowflake-snowpark-python`. For example, if you use `snowflake-snowpark-python==1.23.0` you must use Python version \>=3.8, \<3.12. + Use the correct version of Python required by `snowflake-snowpark-python`. For example, if you use `snowflake-snowpark-python==1.23.0`, you must use Python version \>=3.8, \<3.12. - You must have a Snowflake account. To create a trial account, see the [tutorial](/get-started/installation/streamlit-in-snowflake) in _Get started_. @@ -31,13 +31,13 @@ This guide explains how to securely access a Snowflake database from Streamlit. If you already have a database that you want to use, you can [skip to the next step](#add-connection-parameters-to-your-local-app-secrets). 1. Sign in to your Snowflake account at [https://app.snowflake.com](https://app.snowflake.com). -1. In the left navigation, click "**Projects**," then click "**Worksheets**." +1. In the left navigation, select "**Projects**," and then select "**Worksheets**." 1. To create a new worksheet, in the upper-right corner, click the plus icon (add). You can use a worksheet to quickly and conveniently execute SQL statements. This is a great way to learn about and experiment with SQL in a trial account. -1. Optional: To rename your worksheet, in the upper-left corner, hover over the tab with your worksheet name, and click the overflow menu icon (more_vert). Select "**Rename**", enter a new worksheet name (e.g. "Scratchwork"), and press "**Enter**". -1. To create a new database with a table, in your worksheet's SQL editor, type the following SQL statements, and execute them. +1. Optional: To rename your worksheet, in the upper-left corner, hover over the tab with your worksheet name, and then click the overflow menu icon (more_vert). Select "**Rename**", enter a new worksheet name (e.g. "Scratchwork"), and then press "**Enter**". +1. To create a new database with a table, in your worksheet's SQL editor, type and execute the following SQL statements: ```sql CREATE DATABASE PETS; @@ -56,7 +56,7 @@ If you already have a database that you want to use, you can [skip to the next s - If no lines are highlighted and you click the play button, only the line with your cursor will execute. + If no lines are highlighted and you click the play button, only the line with your cursor will be executed. @@ -75,11 +75,11 @@ If you already have a database that you want to use, you can [skip to the next s Because the SQL statements did not specify a schema, they defaulted to the "PUBLIC" schema within the new "PETS" database. The role and warehouse are trial-account defaults. You can see the role and warehouse used by your worksheet in the upper-right corner, to the left of the "**Share**" and play (play_arrow) buttons. - In Snowflake, databases provide storage and warehouses provide compute. When you configure your connection, you aren't explicitly required to declare role, warehouse, database, and schema; if these are not specified, the connection will use your account defaults. You can also change these settings within an active connection if you need to use multiple roles, warehouses, or databases. However, declaring these defaults avoids unintentional selections. + In Snowflake, databases provide storage, and warehouses provide compute. When you configure your connection, you aren't explicitly required to declare role, warehouse, database, and schema; if these are not specified, the connection will use your account defaults. If you want to use multiple roles, warehouses, or databases, you can also change these settings within an active connection. However, declaring these defaults avoids unintentional selections. 1. To conveniently copy your account identifier, in the lower-left corner, click your profile image, and hover over your account. A popover dialog expands to the right with your organization and account. In the popover, hover over your account, and click the copy icon (content_copy). - The account identifier in your clipboard is period-separated, which is the format used for SQL statements. Paste your account identifier into your notes, and change the period into a hyphen. The Snowflake Connector for Python requires the hyphen-separated format for your account identifier. + The account identifier in your clipboard is period-separated, which is the format used for SQL statements. However, the Snowflake Connector for Python requires a hyphen-separated format. Paste your account identifier into your notes, and change the period to a hyphen. ```toml account = "xxxxxxx-xxxxxxx" @@ -156,7 +156,7 @@ If you already have your connection configured using [Snowflake's connections fi ## Write your Streamlit app -1. Copy the code below to your Streamlit app and save it. If you are not using the example database and table from the first section of this tutorial, replace the SQL query and results handling as desired. +1. Copy the following code to your Streamlit app and save it. If you are not using the example database and table from the first section of this tutorial, replace the SQL query and results handling as appropriate. ```python # streamlit_app.py @@ -170,7 +170,7 @@ If you already have your connection configured using [Snowflake's connections fi st.write(f"{row.NAME} has a :{row.PET}:") ``` - The `st.connection` command creates a `SnowflakeConnection` object and handles secrets retrieval. The `.query()` method handles query caching and retries. By default, query results are cached without expiring. Setting `ttl="10m"` ensures the query result is cached for no longer than 10 minutes. To disable caching, you can set `ttl=0` instead. Learn more in [Caching](/develop/concepts/architecture/caching). + The `st.connection` command creates a `SnowflakeConnection` object and handles secrets retrieval. The `.query()` method handles query caching and retries. By default, query results are cached without expiring. Setting `ttl="10m"` ensures that the query result is cached for no longer than 10 minutes. To disable caching, you can set `ttl=0` instead. Learn more in [Caching](/develop/concepts/architecture/caching). @@ -192,7 +192,7 @@ If you already have your connection configured using [Snowflake's connections fi ![Finished app screenshot](/images/databases/streamlit-app.png) -### Use a Snowpark Session +### Use a Snowpark session The [SnowflakeConnection](/develop/api-reference/connections/st.connections.snowflakeconnection) used above also provides access to [Snowpark sessions](https://docs.snowflake.com/en/developer-guide/snowpark/reference/python/session.html) for dataframe-style operations that run natively inside Snowflake. Using this approach, you can rewrite the app above as follows: diff --git a/content/get-started/installation/sis.md b/content/get-started/installation/sis.md index 95e38bf7a..d28add367 100644 --- a/content/get-started/installation/sis.md +++ b/content/get-started/installation/sis.md @@ -31,13 +31,13 @@ All you need is an email address! Everything else happens in your 30-day trial a Choose your Snowflake edition, provider, and region -1. Answer or skip a few questions to let us know more about yourself. +1. Answer a few questions to let us know more about yourself, or skip them. 1. A message will display: "You're now signed up!" Go to your email, and click on the activation link. (Within your link, note the subdomain. This is your Snowflake account identifier. `https://.snowflakecomputing.com`) 1. Set your username and password. This will be an admin user account within your Snowflake account. Your Snowflake account can have multiple users within it. -1. If you are not signed in after setting your password, follow the instructions to enter your Snowflake account identifier, then enter your username and password. If you've accidentally closed your browser, you can log in at [app.snowflake.com](https://app.snowflake.com/). +1. If you are not signed in after setting your password, follow the instructions to enter your Snowflake account identifier, and then enter your username and password. If you've accidentally closed your browser, you can sign in at [app.snowflake.com](https://app.snowflake.com/). Congratulations! You have a trial Snowflake account. @@ -89,7 +89,7 @@ The databases in the above screenshot are as follows: - App location: "STREAMLIT_DB" and "PUBLIC" - App warehouse: "COMPUTE_WH" (default) or "STREAMLIT_WH" (if you created a new warehouse) - If you can't select your database, refresh the page to ensure the interface is displaying current information. + If you can't select your database, refresh the page to ensure that the interface is displaying current information. 1. Click "**Create**." (Note that the app will run with the rights of "ACCOUNTADMIN" for simplicity. You can curate your roles and permissions to choose who can create and access apps.) @@ -107,7 +107,7 @@ The databases in the above screenshot are as follows: st.write("Hello World") ``` - If you want to get back to the sample code later, you can always make another app to edit the same example again. + If you want to return to the sample code later, you can always make another app to edit the same example again. 1. In the upper-right corner, click the blue "play_arrow **Run**" button to make the running app reflect your changes. @@ -135,17 +135,17 @@ The databases in the above screenshot are as follows: 1. Optional: Make more edits to your app. You must interact with your app or click the blue "play_arrow **Run**" button to display the changes. This is different from a local environment where you can save your changes to trigger a rerun. -1. To go back to Snowsight, in the upper-left corner, click "chevron_left **Streamlit Apps**." +1. To return to Snowsight, in the upper-left corner, click "chevron_left **Streamlit Apps**." ## Return to your app -When you want to view or edit your app again, you can return to it through Snowsight. If you are returning to the site, you can log in at [app.snowflake.com](https://app.snowflake.com/). +When you want to view or edit your app again, you can return to it through Snowsight. If you are returning to the site, you can sign in at [app.snowflake.com](https://app.snowflake.com/). 1. In the left navigation, select "**Projects**" → "**Streamlit**." 1. In your list of apps, click "**Hello World**." - If you don't see your app, check that you have your role set to "ACCOUNTADMIN" as described in [Optional: Create a warehouse](/get-started/installation/streamlit-in-snowflake#optional-create-a-warehouse). + If you don't see your app, check that your role is set to "ACCOUNTADMIN" as described in [Optional: Create a warehouse](/get-started/installation/streamlit-in-snowflake#optional-create-a-warehouse). 1. Your app will open in viewing mode. To edit your app, in the upper-right corner, click "**Edit**."