Skip to content

Commit dd0f4bb

Browse files
committed
Add 2 skills: Streamlit in Snowflake and Data Product Sharing
- streamlit-in-snowflake: Deploy Streamlit apps with warehouse or container runtimes. Templates for setup, warehouse deploy, container deploy, and starter app with Snowflake data access patterns. - data-product-sharing: Share data via secure shares, private listings, org listings, and Snowflake Marketplace. Templates for provider setup, share creation, listing creation, and consumer access. - Updated install_skills.sh with both new skills (descriptions + file lists) - Updated README and skills table (now 13 Snowflake skills total)
1 parent 26aa4ae commit dd0f4bb

15 files changed

Lines changed: 1200 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Skills, MCP tools, and builder apps for AI coding agents working with Snowflake.
1111
- **RAG Search** — Cortex Search + AI_COMPLETE for retrieval-augmented generation over your docs
1212
- **MCP Servers** — Expose Snowflake tools to any MCP-compatible AI client
1313
- **ML Model Registry** — Train, register, and deploy models with `snowflake-ml-python`
14+
- **Streamlit in Snowflake** — Deploy interactive apps with warehouse or container runtimes
15+
- **Data Product Sharing** — Share data via secure shares, listings, and the Snowflake Marketplace
1416
- **Declarative Data Pipelines** — Dynamic Tables with bronze/silver/gold medallion architecture
1517
- **Open Table Format** — Iceberg tables with Snowflake-managed or external catalogs
1618
- **Change Data Capture** — Streams and Tasks for incremental processing and task DAGs
@@ -152,7 +154,7 @@ See [`builder-apps/cortex-agent/`](builder-apps/cortex-agent/) for details.
152154

153155
| Component | Description |
154156
|-----------|-------------|
155-
| [`snowflake-skills/`](snowflake-skills/) | Snowflake-specific skills (Cortex Agents, AI Functions, RAG, MCP, ML Registry, Dynamic Tables, Iceberg, Streams/Tasks, Snowpipe, ETL migration) |
157+
| [`snowflake-skills/`](snowflake-skills/) | Snowflake-specific skills (Cortex Agents, AI Functions, RAG, MCP, ML Registry, Streamlit, Data Sharing, Dynamic Tables, Iceberg, Streams/Tasks, Snowpipe, ETL migration) |
156158
| [`general-skills/`](general-skills/) | General-purpose skills (Docker, Drizzle ORM, Supabase) |
157159
| [`builder-apps/claude-agent/`](builder-apps/claude-agent/) | Claude Code agent UI with Snowflake MCP tools |
158160
| [`builder-apps/cortex-agent/`](builder-apps/cortex-agent/) | Cortex Agent chat UI — no API key needed |

snowflake-skills/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ cp snowflake-ai-kit/snowflake-skills/snowpipe-streaming-python/SKILL.md .cursor/
3636
| [cortex-ai-pipeline](cortex-ai-pipeline/) | Build AI enrichment pipelines using Snowflake Cortex AI Functions (AI_CLASSIFY, AI_SENTIMENT, AI_SUMMARIZE, AI_EXTRACT, AI_COMPLETE, AI_TRANSLATE, AI_AGG) |
3737
| [cortex-mcp-server](cortex-mcp-server/) | Create Snowflake-managed MCP servers to expose Cortex tools (Analyst, Search, Agents, SQL, UDFs) to any MCP client |
3838
| [cortex-search-rag](cortex-search-rag/) | Build Retrieval-Augmented Generation (RAG) pipelines using Snowflake Cortex Search and Cortex AI Functions |
39+
| [data-product-sharing](data-product-sharing/) | Share data products across Snowflake accounts using listings, shares, and the marketplace |
3940
| [dynamic-tables-pipeline](dynamic-tables-pipeline/) | Build declarative data pipelines with Snowflake Dynamic Tables using the medallion architecture (bronze/silver/gold) |
4041
| [iceberg-tables](iceberg-tables/) | Create and manage Apache Iceberg tables on Snowflake with Snowflake-managed or external catalogs |
4142
| [ml-model-registry](ml-model-registry/) | Train, register, and deploy ML models using Snowflake Model Registry |
4243
| [snowpipe-streaming-java](snowpipe-streaming-java/) | Stream data into Snowflake using the Java Snowpipe Streaming SDK |
4344
| [snowpipe-streaming-python](snowpipe-streaming-python/) | Stream data into Snowflake using the Python Snowpipe Streaming SDK |
4445
| [ssis-to-dbt-replatform-migration](ssis-to-dbt-replatform-migration/) | Validates, deploys, and operationalizes SnowConvert AI (SCAI) Replatform output — SSIS to dbt and Snowflake TASKs migrations |
46+
| [streamlit-in-snowflake](streamlit-in-snowflake/) | Deploy Streamlit apps to Snowflake with warehouse or container runtimes |
4547
| [tasks-and-streams](tasks-and-streams/) | Build change data capture pipelines with Snowflake Streams and Tasks |
4648
<!-- END_SKILLS_TABLE -->
4749

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Data Product Sharing
2+
3+
Share Snowflake data with other accounts via secure shares, private listings, or the Snowflake Marketplace. Zero-copy, real-time, no ETL.
4+
5+
## What It Does
6+
7+
This skill helps your AI coding agent:
8+
9+
1. **Prepare data** — Create secure views and organize objects for sharing
10+
2. **Create shares** — Direct account-to-account sharing
11+
3. **Create listings** — Private or marketplace listings with metadata and analytics
12+
4. **Consumer access** — Install and verify shared data on the consumer side
13+
14+
## When to Use
15+
16+
- Sharing tables or views with another Snowflake account
17+
- Publishing data to the Snowflake Marketplace
18+
- Setting up provider/consumer data sharing patterns
19+
- Creating private or organization listings
20+
21+
## Files
22+
23+
| File | Purpose |
24+
|------|---------|
25+
| `SKILL.md` | Agent instructions and workflow |
26+
| `templates/setup.sql` | Source data and provider infrastructure |
27+
| `templates/create-share.sql` | Direct share with grants |
28+
| `templates/create-listing.sql` | Private and marketplace listing patterns |
29+
| `templates/consumer-access.sql` | Consumer-side install and verification |
30+
31+
## Prerequisites
32+
33+
- Provider: `CREATE SHARE` privilege (ACCOUNTADMIN by default)
34+
- Listings: `CREATE DATA EXCHANGE LISTING` privilege
35+
- Consumer: `CREATE DATABASE` + `IMPORT SHARE` privileges
36+
- Marketplace: Provider profile + terms acceptance
37+
38+
## Quick Start
39+
40+
```sql
41+
-- Create and populate a share
42+
CREATE SHARE product_data_share;
43+
GRANT USAGE ON DATABASE analytics_db TO SHARE product_data_share;
44+
GRANT USAGE ON SCHEMA analytics_db.public TO SHARE product_data_share;
45+
GRANT SELECT ON TABLE analytics_db.public.products TO SHARE product_data_share;
46+
ALTER SHARE product_data_share ADD ACCOUNTS = target_org.target_account;
47+
```
48+
49+
## Links
50+
51+
- [About listings](https://docs.snowflake.com/en/collaboration/collaboration-listings-about)
52+
- [CREATE SHARE reference](https://docs.snowflake.com/en/sql-reference/sql/create-share)
53+
- [Create and publish a listing](https://docs.snowflake.com/en/collaboration/provider-listings-creating-publishing)
54+
- [Secure Data Sharing overview](https://docs.snowflake.com/en/user-guide/data-sharing-intro)
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
---
2+
name: data-product-sharing
3+
description: "Share data products across Snowflake accounts using listings, shares, and the marketplace. Use for: data sharing, CREATE SHARE, CREATE LISTING, private listings, marketplace listings, cross-account sharing, secure data sharing, provider/consumer, application packages, data products, organization listings. Triggers: share data, data product, listing, marketplace, cross-account, share table, share view, provider studio, consumer, secure share, private share, auto-fulfillment."
4+
---
5+
6+
# Data Product Sharing
7+
8+
Share tables, views, and other Snowflake objects with other accounts — privately or on the Snowflake Marketplace. No data copying, no ETL, real-time access.
9+
10+
## When to Use
11+
12+
- User wants to share data with another Snowflake account
13+
- User mentions listings, marketplace, data products, or secure sharing
14+
- User needs to set up provider/consumer data sharing
15+
- User wants to publish to Snowflake Marketplace
16+
- User needs cross-region or cross-cloud data sharing (auto-fulfillment)
17+
18+
## Tools Used
19+
20+
- `snowflake_sql_execute` — Create shares, grants, listings, verify access
21+
- `ask_user_question` — Confirm sharing model, target accounts, access type
22+
- `read` / `write` / `edit` — Configure SQL templates with user-specific values
23+
24+
## Bundled Files
25+
26+
```
27+
data-product-sharing/
28+
├── SKILL.md # This file (agent instructions)
29+
├── README.md # Human-facing docs
30+
└── templates/
31+
├── setup.sql # Source data and provider setup
32+
├── create-share.sql # Secure share with grants
33+
├── create-listing.sql # Private and marketplace listings
34+
└── consumer-access.sql # Consumer-side install and query
35+
```
36+
37+
---
38+
39+
## Phase 0: Briefing
40+
41+
Present this to the user before starting:
42+
43+
> **Snowflake Data Sharing** lets you share live data with other Snowflake accounts — no copying, no ETL, no storage costs for consumers.
44+
>
45+
> Three sharing methods:
46+
> - **Direct Share** — Point-to-point sharing with specific accounts. Simplest. Consumer gets a read-only database.
47+
> - **Private Listing** — Like a direct share but with metadata, usage analytics, and support for paid access. Best for business partnerships.
48+
> - **Marketplace Listing** — Publish publicly on Snowflake Marketplace. Best for broad distribution.
49+
>
50+
> I'll help you:
51+
> 1. Prepare the data you want to share
52+
> 2. Create a share or listing
53+
> 3. Configure consumer access
54+
> 4. Verify end-to-end
55+
56+
---
57+
58+
## Workflow
59+
60+
### Step 1: Gather Requirements
61+
62+
Ask the user:
63+
- **What data?** Database, schema, specific tables/views to share
64+
- **Who?** Target accounts (org.account format) or public marketplace
65+
- **How?** Direct share, private listing, or marketplace listing
66+
- **Access type?** Free, limited trial, or paid
67+
68+
**Decision guide:**
69+
70+
| Need | Method | Why |
71+
|------|--------|-----|
72+
| Quick share with one account | Direct Share | Simplest, no listing overhead |
73+
| Share with metadata and analytics | Private Listing | Usage tracking, descriptions, sample queries |
74+
| Broad distribution | Marketplace Listing | Publicly discoverable |
75+
| Monetize data | Paid Listing | Stripe integration for payments |
76+
| Internal org sharing | Organization Listing | Internal marketplace for business units |
77+
| Share apps + data + agents | Application Package (TYPE=DATA) | Declarative sharing via manifest |
78+
79+
**For application packages (TYPE=DATA)** with agents, semantic views, or notebooks — use the `declarative-sharing` bundled skill instead. This skill covers share-based and listing-based sharing.
80+
81+
**Defaults if not specified:**
82+
- Method: `direct share`
83+
- Access type: `free`
84+
85+
### Step 2: Prepare Source Data
86+
87+
Load `templates/setup.sql` and customize:
88+
- Replace `{{DATABASE}}`, `{{SCHEMA}}` with source database/schema
89+
- Create or identify the tables/views to share
90+
- Ensure objects are in a database the sharing role owns
91+
92+
**Key rule**: You share a database, then grant access to specific objects within it. You cannot share individual objects without a database context.
93+
94+
**Best practice**: Create secure views over raw tables to control what consumers see:
95+
```sql
96+
CREATE OR REPLACE SECURE VIEW share_ready_view AS
97+
SELECT col1, col2, col3 -- only columns you want to expose
98+
FROM raw_table
99+
WHERE is_public = TRUE; -- row-level filtering
100+
```
101+
102+
**STOP**: Confirm which objects to share before proceeding.
103+
104+
### Step 3: Create Share or Listing
105+
106+
Based on Step 1 decision:
107+
108+
**Option A: Direct Share** — Load `templates/create-share.sql`
109+
- Creates a share, grants usage on database/schema, grants SELECT on tables/views
110+
- Adds consumer accounts
111+
112+
**Option B: Private Listing** — Load `templates/create-listing.sql`
113+
- Creates a share first (same as Option A)
114+
- Then wraps it in a listing with metadata
115+
116+
**Option C: Marketplace Listing** — Guide user to Provider Studio in Snowsight
117+
- Requires a provider profile (one-time setup)
118+
- Must accept Snowflake Provider and Consumer Terms
119+
- Listing goes through approval process
120+
121+
Execute the appropriate SQL.
122+
123+
### Step 4: Consumer-Side Access
124+
125+
Share `templates/consumer-access.sql` with the consumer (or run it if testing in a second account):
126+
- Creates a database from the share/listing
127+
- Grants usage to consumer roles
128+
- Verifies data is accessible
129+
130+
### Step 5: Verify End-to-End
131+
132+
**Provider side:**
133+
```sql
134+
SHOW SHARES;
135+
DESCRIBE SHARE {{SHARE_NAME}};
136+
-- For listings:
137+
SHOW LISTINGS;
138+
```
139+
140+
**Consumer side:**
141+
```sql
142+
SHOW AVAILABLE LISTINGS;
143+
-- or
144+
SHOW SHARES;
145+
SELECT * FROM {{CONSUMER_DB}}.{{SCHEMA}}.{{TABLE}} LIMIT 10;
146+
```
147+
148+
---
149+
150+
## Sharing Reference
151+
152+
### What Can Be Shared
153+
154+
| Object | Shareable | Notes |
155+
|--------|-----------|-------|
156+
| Tables | Yes | SELECT grant |
157+
| Secure Views | Yes | Recommended over raw tables |
158+
| Secure UDFs | Yes | Including UDTFs |
159+
| Secure Materialized Views | Yes | Consumer sees materialized data |
160+
| Schemas | Yes | Via USAGE grant |
161+
| Databases | Yes | Required as container |
162+
163+
### Access Control
164+
165+
| Role | Privileges Needed |
166+
|------|-------------------|
167+
| Provider (share creator) | `CREATE SHARE` on account |
168+
| Provider (listing creator) | `CREATE DATA EXCHANGE LISTING` on account |
169+
| Consumer (access listing) | `CREATE DATABASE`, `IMPORT SHARE` |
170+
171+
### Key SQL Commands
172+
173+
```sql
174+
-- Shares
175+
CREATE SHARE ... -- Create empty share
176+
GRANT USAGE ON DATABASE ... TO SHARE ... -- Add database
177+
GRANT USAGE ON SCHEMA ... TO SHARE ... -- Add schema
178+
GRANT SELECT ON TABLE ... TO SHARE ... -- Add table
179+
ALTER SHARE ... ADD ACCOUNTS = ... -- Add consumers
180+
DESCRIBE SHARE ... -- View share contents
181+
REVOKE ... FROM SHARE ... -- Remove access
182+
183+
-- Consumer side
184+
CREATE DATABASE ... FROM SHARE ... -- Mount shared data
185+
-- or
186+
CREATE DATABASE ... FROM LISTING ... -- Install from listing
187+
188+
-- Listings (SQL)
189+
SHOW LISTINGS;
190+
DESCRIBE LISTING ...;
191+
```
192+
193+
### Auto-Fulfillment (Cross-Region)
194+
195+
When sharing with accounts in different regions, Snowflake automatically replicates data:
196+
- Provider sets refresh frequency (default: 1 hour)
197+
- Consumer sees data with slight lag
198+
- Provider pays for replication compute and storage
199+
200+
---
201+
202+
## Stopping Points
203+
204+
- **Step 2**: Confirm which objects to share
205+
- **Step 3**: Review share/listing before adding consumer accounts
206+
- **Step 5**: Verify consumer can query the data
207+
208+
## Common Patterns
209+
210+
**Secure view with row-level filtering:**
211+
```sql
212+
CREATE OR REPLACE SECURE VIEW shared_orders AS
213+
SELECT order_id, product, amount, region
214+
FROM orders
215+
WHERE region = CURRENT_ACCOUNT(); -- per-consumer filtering
216+
```
217+
218+
**Reader accounts (for non-Snowflake consumers):**
219+
```sql
220+
CREATE MANAGED ACCOUNT consumer_reader
221+
ADMIN_NAME = 'admin'
222+
ADMIN_PASSWORD = 'ChangeMe123!'
223+
TYPE = READER;
224+
225+
ALTER SHARE my_share ADD ACCOUNTS = consumer_reader;
226+
```
227+
228+
**Revoking access:**
229+
```sql
230+
ALTER SHARE my_share REMOVE ACCOUNTS = target_org.target_account;
231+
-- or
232+
DROP SHARE my_share;
233+
```

0 commit comments

Comments
 (0)