Repository navigation
feat: add streaming queries and CSV/JSONL exports - #25
Conversation
- Add lazy row streams and bounded row batches to both clients, preserving parameter binding, value conversion, polling, retries, and query instrumentation. - Add CSV and JSONL exports to caller-owned text streams, including metadata-derived CSV headers for empty results and exact Decimal text. - Reject malformed streaming data and duplicate export column names, stop fetching when consumption stops, and document partial-output behavior.
Retain the inner iterator and assert that closing a row stream or batch stream closes it immediately on both clients. This distinguishes prompt cleanup from deferred finalization without changing production behavior.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Summary
Large query results can be processed or exported without collecting every row in memory.
Docs: updated
Supported behavior
Snowflake returns completed query results in individually retrievable partitions.
The client consumes those partitions on demand; memory scales with the largest
decoded server partition plus the application batch or serialized row.
This does not provide rows before statement execution completes or impose a byte limit.
Sources: Snowflake response handling
and SQL API reference.
Backwards compatibility
Additive public APIs: query_stream, query_batches, export_csv, and export_jsonl,
with synchronous and asynchronous equivalents. Existing query, execute, and
QueryHandle.result behavior and return types remain unchanged. No new runtime dependencies.
Streaming data validation applies only to the new APIs.
Review
The full implementation at 8f36a2d has been checked. The subsequent test-only
commit d6fdc63 strengthens immediate inner-iterator cleanup assertions for the
public stream wrappers; production code is unchanged. Negative controls confirm
that those assertions fail when cleanup is removed, on both clients.
Exempt from re-review: test-only at d6fdc63, tests/test_streaming.py.
Changes
Test plan
Full suite: 278 passed, 9 live tests skipped; 96% coverage.
Repository hooks: lint, formatting, types, and secret detection pass.
Wheel and source distribution build successfully.
Negative controls for eager fetching, query instrumentation, and immediate stream cleanup.
Sync/async coverage for lazy fetching, cross-partition batches, gzip and bare-array responses, retries, empty results, value conversion, and failure cleanup.
Live Snowflake smoke tests: credentials are not configured in this environment.
CI: awaiting maintainer approval for the fork workflow run.
No visual effect.