Working in Snowflake
View

Workspaces

Snowsight worksheets are the fastest way to run interactive SQL and Python against RWD. Open one, set your role and warehouse, and query. This page covers the two worksheet types, how to create and run them, and the warehouse/role context that decides whether your query runs at all.

What worksheets are

A worksheet is a saved, runnable editor inside Snowsight (Snowflake’s web UI at app.snowflake.com), found under Projects › Worksheets. Each worksheet runs in its own session with a single role and warehouse — its context. There are two kinds:

TypeWhat it runsUse it for
SQL worksheetOne or more SQL statementsAd-hoc queries, cohort exploration, quick lookups — the default for most RWD work.
Python worksheetA Snowpark main(session) handlerDataFrame-style transforms and light Python logic that stays inside Snowflake (no data egress).

Reach for a SQL worksheet first. Use a Python worksheet when you want to chain Snowpark DataFrame operations or call Python libraries against the same data without pulling it out of the warehouse. For multi-cell, notebook-style work, use a Snowflake Notebook instead.

Create and run a worksheet

Sign in to Snowsight at app.snowflake.com and go to Projects › Worksheets. Select + and choose SQL Worksheet or Python Worksheet. The new worksheet opens with a date/time title and defaults to your default role and warehouse.

  • SQL: type your statements and run the current statement, or run all. Each statement executes on the worksheet’s warehouse.
  • Python: Snowsight scaffolds a handler that receives a Snowpark session. Edit the body, set the handler and any packages in the settings panel, and run the whole worksheet.
Python worksheet
import snowflake.snowpark as snowparkfrom snowflake.snowpark.functions import col
def main(session: snowpark.Session):    df = session.table("LIMS_PUB.BASE_RENASIGHT")    df = df.filter(col("casefile_id") == "CF-12345")    df.show()    return df  # returned DataFrame renders in Results

Set your role and warehouse

At the start of a session, set the role you intend to use and a warehouse to run on. In a SQL worksheet the cleanest way is explicit USE statements at the top:

sql
USE ROLE RWD_RESEARCHER_PHI_ROLE;USE WAREHOUSE RWD_PRODUCTION_QUERY_INTERACTIVE_WH;

Pick the smallest warehouse that fits the workload. Replace {ENV} with DEVELOPMENT, PREPRODUCTION, or PRODUCTION.

Use caseWarehouseWho
Ad-hoc queries, quick lookupsRWD_{ENV}_QUERY_INTERACTIVE_WHEngineers, Researchers
Heavy analytics, large aggregationsRWD_{ENV}_QUERY_ANALYTICS_WHAnalysts
BI dashboardsRWD_{ENV}_BI_WHViewers
AI / Cortex / semantic views / StreamlitRWD_{ENV}_AI_WHAnalysts, Streamlit devs
dbt / ETL transforms (admin only)RWD_{ENV}_ETL_TRANSFORM_WHEngineers

Switching role and warehouse mid-session

There are two ways to change the worksheet context. Either re-run USE statements:

sql
USE ROLE RWD_ANALYST_PHI_ROLE;USE WAREHOUSE RWD_PRODUCTION_QUERY_ANALYTICS_WH;

…or use the role and warehouse pickers in the worksheet’s context selector. The chosen context is preserved for future sessions and shared with everyone who opens the same worksheet. You can only select a role granted to you and a warehouse your role has USAGE on.

Persistence and sharing

Local edits autosave roughly every few seconds and are private to you until you run the worksheet; running publishes the latest version to anyone the worksheet is shared with. Snowsight keeps version history.

  • Share a worksheet with other signed-in Snowsight users (or via link, if link sharing is enabled). Recipients can view, run, edit, and duplicate per the permission you grant.
  • Running a shared worksheet requires the worksheet’s run-as role; recipients without it can still duplicate it and run the copy under their own role.
  • Viewing past results requires the primary role that produced them.

Getting help

Stuck on a worksheet, role, or warehouse error? Ask in #rwd-snowflake-help.