feat(bigquery): Support queryResultsFormat and compressionCodec in query_and_wait()
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 52/100
Rechercherichtung
Beginne bei Client.query_and_wait(), verfolge dann _job_helpers.py für den BigQuery-Anforderungspayload und table.py für RowIterator und das Arrow-Parsing. Vergleiche den zugehörigen PR 18027 und überprüfe, dass beide Optionen akzeptiert, an die API gesendet werden und dass komprimierte Arrow-Ergebnisse die genannten Anwendungsfälle für to_arrow() und to_dataframe() unterstützen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Determine this is the right repository
- I determined this is the correct repository in which to report this feature request.
Summary of the feature request
Feature Description
Add support for query_results_format (e.g., "ARROW") and compression_codec (e.g., "LZ4_FRAME") in Client.query_and_wait() and related job helper functions in google-cloud-bigquery.
Use Case & Problem Statement
Currently, Client.query_and_wait() executes a query and fetches results, but does not allow callers to request the underlying query results format as Apache Arrow streams or specify compression options directly during the fetch process.
For high-performance data processing pipelines using Apache Arrow or PyArrow, requesting query results in Arrow format with compression significantly reduces network payload size, deserialization overhead, and total query result fetch latency.
Proposed Solution
- Update
google.cloud.bigquery.client.Client.query_and_wait()to accept optional parameters:query_results_format: Optional string specifying result serialization format (e.g."ARROW").compression_codec: Optional string specifying compression algorithm
- Update underlying helper functions in
_job_helpers.pyto populate these options in the request payload sent to the BigQuery API. - Update
RowIteratorand Arrow parsing logic intable.pyto seamlessly handle Arrow record batch streams whenquery_results_format="ARROW"is specified.
Alternative Approaches Considered
- Manually constructing custom
QueryJobinstances and extracting Arrow record batches post-execution, which requires boilerplate code and loses the convenience ofquery_and_wait().
Additional Context
Related PR: https://github.com/googleapis/google-cloud-python/pull/18027
Desired code experience
from google.cloud import bigquery
client = bigquery.Client()
query = "SELECT * FROM bigquery-public-data.usa_names.usa_1910_2013 LIMIT 10000"
Request query results directly in Apache Arrow format with LZ4_FRAME compression
results = client.query_and_wait(
query,
query_results_format="ARROW",
compression_codec="LZ4_FRAME",
)
Convert directly to PyArrow Table or Pandas DataFrame
arrow_table = results.to_arrow()
df = results.to_dataframe()
Expected results
- Client.query_and_wait() accepts query_results_format and compression_codec parameters.
- The BigQuery API receives these parameters in the job execution request.
- Query results are returned and parsed efficiently via compressed Apache Arrow streams into the resulting RowIterator / Arrow table without client errors.
API client name and version
No response
Use case
e.g. This feature would be useful in a scenario where I need to process large amounts of data efficiently.
Additional context
https://github.com/googleapis/google-cloud-python/pull/18027
- Vorherrschende Sprache
- Python
- Sterne
- 5.4k
- Forks
- 1.8k
- Ø Merge
- 2 T. 7 Std.
- Gemergte PRs (30 T.)
- 173
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-cloud-python
-
firestore: field path with a quoted name ending in a backslash is misparsedEvtl. vergeben @sebxt hat das vor 25 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-python#18771 ·
Maintainer antworten meist innerhalb von 1 Tag
-
api: spanner type: feature request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
googleapis/google-cloud-python#18584 ·
Maintainer antworten meist innerhalb von 1 Tag
-
auth: `impersonated_credentials` loses `subject` on copy, so `with_scopes()` and `with_quota_project()` turn off domain wide delegationEvtl. vergeben @Om-singhaI hat das vor 55 Tagen übernommen. Offenauth priority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
googleapis/google-cloud-python#18428 ·
Maintainer antworten meist innerhalb von 1 Tag
-
A client called `run_in_transaction` be stuck if Spanner is downEvtl. vergeben @founderinaction hat das vor 7 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
googleapis/google-cloud-python#18375 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
ci: enable --strict flag in presubmit twine_checkEvtl. wieder frei @ohmayr hat das vor 44 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
googleapis/google-cloud-python#18339 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/google-cloud-python
Ähnliche Issues
-
plot_graph crashes when a mesh node has no m2m edgeEvtl. vergeben @tygvi hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
mllam/neural-lam#883 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
enhancement possible-duplicate
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
AOSSIE-Org/PictoPy#1715 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 6 Tagen
-
SQLite connector omits generated columns from the catalog, and drops relationships sourced on themOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
NVIDIA/auto-ontology#511 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
ethereum/execution-specs#3996 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
cpp-best-practices/project_validator#267 ·
Maintainer antworten meist innerhalb von 1 Tag