Features — pinky-snowpark
Update date : 2026-05-31 20:23
Feature list ordered by priority. stable = in production. planned = not yet built, order = priority.
Planned
Ordered by priority — closest to implementation first.
MVP — migration from backup
Both modules are production-ready in _BACKUP/snowflake-kit-snowpark-bak.
MVP = clean migration into the pinky-snowpark repo structure + repo scaffold.
snowpark.py
| Feature | Description |
|---|---|
| Session helpers | collect_dicts(), execute_statements(), run_generated_sql(), validate_sql() |
| Role context manager | with_role(session, role) — temporary elevation, restores on exit |
| SP lifecycle telemetry | load_kwargs(), sp_trace(), to_telemetry_attrs() (flat span attributes for EVENT_TABLE) |
| Stage I/O | stage_write() — CSV / JSON / Parquet / Avro, optional PGP encryption, optional registry table append |
| PGP helpers | load_pgp_key(), decrypt_file() with auto format detection |
| Rotating filenames | get_rotating_filename() with 5 retention slots |
| Environment derivation | get_environment(session, EnvPattern) + EnvPattern enum (ACCOUNT / DATABASE_SUFFIX / DATABASE_PREFIX / SCHEMA_SUFFIX / SCHEMA_PREFIX) |
excel.py
| Feature | Description |
|---|---|
| Workbook generation | create_workbook_from_df() — DataFrame → formatted .xlsx |
| Workbook parsing | parse_worksheet() — Excel → DataFrame |
| Format presets | CELL_FORMATS — 30+ presets (FR/EN dates, currencies, numeric, styles) |
with_user — temporary user impersonation
with_user(session, username) context manager — same pattern as with_role().
Use case: audit trails in multi-tenant SPs.
decrypt_file — in-memory mode
Currently writes to /tmp/. Small files (<50 MB) should decrypt in-memory to avoid disk I/O inside Snowflake.
excel.py — conditional cell formatting
Alternating row colors and threshold-based highlights. Extends existing CELL_FORMATS presets.
SP test harness
Lightweight local Snowpark session mock for unit testing SPs without a live Snowflake connection.
Backlog
- Async stage write — background thread upload, returns future
- Registry UI — Streamlit component reading the
stage_write()registry table - Snowsight deep links — direct links to query results / dashboards / worksheets