GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Split query specification (kind, filter, ancestor, etc.) from query execution (results, cursor, more_results) · Issue #439 · googleapis/google-cloud-python

Split query specification (kind, filter, ancestor, etc.) from query execution (results, cursor, more_results) #439

New issue
Copy link
New issue
Copy link
Closed
#487
Closed
Split query specification (kind, filter, ancestor, etc.) from query execution (results, cursor, more_results)#439
#487
Copy link
Assignees
tseaver
Labels
api: datastoreIssues related to the Datastore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@tseaver
tseaver
opened on Dec 18, 2014
Issue body actions

(Continued from #432)

In larger applications, I envision a set of Query objects which are pre-built, something like "prepared statements" in SQL-based apps. Application code would reuse them over and over without needing to re-construct them on the fly.

In the current setup, the application code would have to do that by cloning the queries (even though they weren't going to be modifying the filters). It would be nice if the short-lived / stateful concerns weren't intertwined with the long-lived, stateless ones.

The pattern I'm proposing is something like::

from datastore.query import Query

pending_reports = Query('Expense Report).filter('status', '==', 'pending')

def show_pending_reports(request):
    cursor = pending_reports.fetch()

    for report in cursor:
        show_report(report)

Under the covers, iterating the cursor would cause it to fetch subsequent pages until there were no more (or until the user-supplied limit had been reached). The source Query (pending_reports) would be uninvolved in any of that machinery.

The cursor would have methods for checking whether the back-end reported more results were available, as well as keeping (internal) track for the start_cursor / end_cursor bits for paging. If the user wanted to interact with them directly, she could:

def show_pending_reports(request):
    cursor = pending_reports.fetch()

    for page in cursor.pages():
        for report in page:
            show_report(report)

Activity

Next
  1. tseaver
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    api: datastoreIssues related to the Datastore API.
    on Dec 18, 2014
  2. tseaver
    self-assigned this
    on Jan 2, 2015
  3. tseaver
    closed this as completedin #487on Jan 6, 2015
  4. tseaver
    added a commit that references this issue on Jan 6, 2015

    Merge pull request #487 from tseaver/439-split_query_iterator

    This issue will close once commit 9142051 is merged into the 'main' branch.
    9142051
  5. jgeewax
    modified the milestone: This milestone has been deleted on Jan 30, 2015
  6. atulep
    added 3 commits that reference this issue on Apr 3, 2023

    chore: Bump gapic-generator-python version to 1.3.0 (#439)

    fd4c707

    chore: Bump gapic-generator-python version to 1.3.0 (#439)

    c7318a7

    chore: Bump gapic-generator-python version to 1.3.0 (#439)

    a78cf8e
  7. atulep
    added a commit that references this issue on Apr 18, 2023

    chore: Bump gapic-generator-python version to 1.3.0 (#439)

    b8ae1ee
  8. parthea
    added 3 commits that reference this issue on Jun 4, 2023

    chore(deps): update dependency mock to v5.0.1 (#439)

    9c800ad

    chore(deps): update all dependencies (#439)

    b70ce51

    feat: enable "rest" transport in Python for services supporting numer…

    b25a532
  9. parthea
    added a commit that references this issue on Jul 6, 2023

    chore: store artifacts in placer [autoapprove] (#439)

    2fe8dc3
  10. 6 remaining items

  11. parthea
    added 5 commits that reference this issue on Oct 21, 2023

    chore(python): update .kokoro/requirements.txt (#439)

    808f542

    docs: fix changelog header to consistent size (#439)

    30321d2

    fix(deps): require protobuf >= 3.20.2 (#439)

    8a67675

    chore: Update gapic-generator-python to v1.11.9 (#439)

    3e95924

    chore: Bump gapic-generator-python version to 1.3.0 (#439)

    ecaa5fe
  12. parthea
    added a commit that references this issue on Aug 21, 2025

    chore: use gapic-generator-python 0.65.1 (#439)

    163f998
  13. parthea
    added a commit that references this issue on Sep 16, 2025

    chore: use gapic-generator-python 0.65.1 (#439)

    9244320
  14. parthea
    added 6 commits that reference this issue on Nov 22, 2025

    chore(python): fix formatting issue in noxfile.py.j2 (#439)

    17fae9d

    Update dependency dataclasses to v0.7 (#439)

    adb3793

    feat: named database support (#439)

    8eabeca

    build(deps): [autoapprove] bump cryptography from 41.0.0 to 41.0.2 (#439

    7ba3904

    fix: make sure datastore key constructor never gets None in a pair (#446

    1c08a88

    fix: set Content-Type header in the request to signBlob API to avoid …

    9b1f56a
  15. parthea
    added 2 commits that reference this issue on Mar 9, 2026

    chore(deps): update dependency google-crc32c to v1.6.0 (#439)

    b8d5938

    chore: add library type to .repo-metadata.json (#439)

    51897d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

api: datastoreIssues related to the Datastore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.