Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update QueryEngine API to support multiple results tables #2363

Open
wants to merge 8 commits into
base: evansd/batch-download-nonunique
Choose a base branch
from

Conversation

evansd
Copy link
Contributor

@evansd evansd commented Jan 17, 2025

This PR refactors the query engine API and the plumbing around it such that it could in principle support returning event-level data if only we had some datasets which returned more than one query.

The major change to the query engine API is replacing the get_results() method, which returned an iterator over a single table of results, with get_results_tables() which returns a nested iterator over multiple tables of results.

To avoid massive changes to the test suite (and particularly to the under-development dummy data tests) we retain a get_results() method which asserts that we only have a single table of results and returns it as previously.

The SQL engines also change their get_query() method to get_queries() to support multiple queries.

Copy link

cloudflare-workers-and-pages bot commented Jan 17, 2025

Deploying databuilder-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: b69dd1c
Status: ✅  Deploy successful!
Preview URL: https://dfba0cb9.databuilder.pages.dev
Branch Preview URL: https://evansd-extend-query-engine-a.databuilder.pages.dev

View logs

In future Datasets will be able to produce more than one results table
and so this is the API we need.
If you've got a single table to read then it's obviously sensible
to ask to read this from e.g. a single CSV file. But if you've got multiple
tables to read then you'll need to supply e.g. a directory of CSV files.
Similarly for writing data.

Handling this logic inside the functions here simplifies things
elsewhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant