Interactive experience where attendees write and address a physical postcard, then use Snowflake to maps its journey from Moscone Center to anywhere in the USA — powered by Snowflake geospatial functions, Cortex AI, and Streamlit.
postcard-summit/
├── init_db.sql ← Run once in Snowflake to set up DB, table, views
├── cli_app.py ← CLI app for 6 booth laptops
├── tv_map.py ← Streamlit real-time map for the TV display
├── requirements.txt
├── .env.example ← Copy to .env and fill in credentials
└── README.md
cp .env.example .env
# Edit .env with your Snowflake account/user/password/role/warehouseYour role must have:
USAGEonZIP_CODES_DB.POSTALADMIN(Marketplace dataset)ALLonSUMMIT_APP(created by the SQL script)USAGEonPOSTCARD_WH
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtRun init_db.sql in a Snowflake worksheet (or via SnowSQL):
snowsql -f init_db.sqlpython cli_app.pyEach attendee:
- Enters their destination zip code
- Sees distance calculated via Snowflake
ST_DISTANCE - Record inserted into
postcard_entries - Can ask Cortex AI a question about today's data
- Type
done→ next attendee
streamlit run tv_map.py- Auto-refreshes every 4 seconds
- Shows KPI metrics: total postcards, total miles, top state
- Arc map from SF to all destinations
- State leaderboard + recent entries sidebar
| Feature | Where Used |
|---|---|
ST_MAKEPOINT |
Build point geometry from lat/lon |
ST_DISTANCE |
Great-circle distance in metres → miles |
ST_MAKELINE |
Build LineString flight path |
GEOGRAPHY column type |
Stores the arc path in postcard_entries |
SNOWFLAKE.CORTEX.COMPLETE |
AI Q&A grounded in live data |
| Marketplace data | ZIP_CODES_DB.POSTALADMIN."zcr_usa_zip_centroids" |
| MVCC (no row-locks) | Safe concurrent INSERTs from 6 laptops |
The CLI uses mistral-large2 by default (widely available across regions).
To change it, edit the model name in cli_app.py → ask_cortex().
Available alternatives: snowflake-arctic, llama3-70b, gemma-7b
Snowflake uses MVCC (Multi-Version Concurrency Control) — INSERT statements never block each other. All 6 laptops can write simultaneously without any application-level locking needed.