Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

query.py file missing #7

Closed
welshamy opened this issue Sep 13, 2018 · 1 comment
Closed

query.py file missing #7

welshamy opened this issue Sep 13, 2018 · 1 comment

Comments

@welshamy
Copy link

welshamy commented Sep 13, 2018

The ndb-orm/query.py file is missing. Running any query with Model.query() results in error:

File "/home/.../venv/lib/python3.6/site-packages/ndb_orm/model.py", line 3420, in _query
    from .query import Query  # Import late to avoid circular imports.
ModuleNotFoundError: No module named 'ndb_orm.query'

README.md says:

This is not a drop-in replacement for the whole ndb package (no ndb.context, ndb.tasklets, ndb.query or ndb.Key), but allows you to use ndb.model classes.

So the file might be intentionally omitted. This code throws an exception when properly used though.

How to reproduce:

  • Create an entity Person
  • Call Person.query()
@berlincode
Copy link
Owner

Hi.

You are completely right. The query.py file is missing intentionally. Ndb-orm aims to make a migration as simple as possible. The focus is to make ndb models usable on platforms where ndb is not supported.

For creating queries you (currently) need to the underlying gcloud datastore directly:

datastore_client.query(
    kind=Person._get_kind()
)

I think it should be possible to create a wraper for most common query use cases. I'm currently missing time for this.

I've added 'tests_query_simply.py' to show how to use queries (in 'tests' subdirectory).

Hope this helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants