feat: add Store and StorageFormat with options support for result storage#57
Closed
james-willis wants to merge 1 commit intowherobots:mainfrom
Closed
feat: add Store and StorageFormat with options support for result storage#57james-willis wants to merge 1 commit intowherobots:mainfrom
james-willis wants to merge 1 commit intowherobots:mainfrom
Conversation
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Storedataclass andStorageFormatenum in newresult_store.pymodule for configuring query result storage to cloud storage (S3)options(e.g.{"ignoreNullFields": "false"}for GeoJSON,{"header": "false"}for CSV) that override server defaultsstoreparameter throughconnect()→Connection→Cursor.execute()so it can be set at connection level or per-queryDetails
This brings the Python DB-API driver to feature parity with the JDBC driver (wherobots-jdbc-driver#19) and the server-side support (sql-session#190).
New module:
wherobots/db/result_store.pyStorageFormatenum:PARQUET,CSV,GEOJSONStorefrozen dataclass with fields:format,single,generate_presigned_url,optionsStore.for_download()factory for the common single-file + presigned URL patternStore.to_dict()for WebSocket protocol serializationgenerate_presigned_urlrequiressingle=Trueto_dict()None(omitted from serialized dict)Modified files
connection.py: Acceptsstoreparameter, passes toCursor, includesstore.to_dict()inexecute_sqlWebSocket requestcursor.py: Acceptsdefault_storefrom connection;execute()accepts per-querystoreoverridedriver.py:connect()andconnect_direct()accept and forwardstoreparameter__init__.py: ExportsStoreandStorageFormatREADME.md: Documents store usage, store options, and connection-level defaultsTests:
tests/test_result_store.py(21 tests)StorageFormatenum values and defaultStoreconstruction, options handling (empty/None normalization, defensive copy, immutability)for_download()factory methodto_dict()serialization with/without optionsexecute_sqlrequest shapeUsage
Dependencies
optionsfield)