NQDB
Not quite the DB Google used to have, not quite the DB Google has now. Of course, better than both.
This is a mock of NDB, almost. It enables interfacing to Google Datastore, or to other DBs, by changing the client.
Usage
Models
from nqdb import *
client = DatastoreClient()
class Person(Model):
_client = client
first_name = StringProperty('first_name')
last_name = StringProperty('last_name')
p = Person()
p.first_name = "Luca"
p.last_name = "de Alfaro"
p.put()
id = p.key_id
print("id:", id)
q = Person(id=id)
q.get()
print("First name:", q.first_name)
print("Last name:", q.last_name)
Keys
p = Person()
p.first_name = "Joe"
p.last_name = "Falchetto"
put(p)
id = p.key_id
k = Key(Person, id)
q = k.get()
Batch operations
from nqdb import put_multi
p = Person()
p.first_name = "Joe"
p.last_name = "Falchetto"
q = Person()
q.first_name = "Luca"
q.last_name = "de Alfaro"
put_multi([p, q])
The client used by put_multi is derived from the client used for p and q.
You cannot mix in the same batch operations models with different clients.
Queries
q = Person.query()
q.filter(Person.first_name == 'Luca')
q.filter(Person.gender == 'Male')
for p in q.fetch():
print(p.last_name)
You can add an ordering to a query by:
q.order(+Person.first_name)
You can use both +Person.first_name and -Person.first_name,
but one of +, - should be present.
Caching
client = DatastoreClient(cache=MyCache())
Look at cache.Cache to see the (very few) methods you need to implement to use a new cache.
And as usual, look at the test files, because those do not lie.
Metadata
Release files for nqdb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nqdb-0.1.0.tar.gz | 11.9 kB | Without provenance | Details for nqdb-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nqdb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nqdb-0.1.0-py3-none-any.whl |
Total release size: 25.5 kB
Release files / nqdb-0.1.0.tar.gz
| Download URL | nqdb-0.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86b92a3649353a1b380a6f024c40d5e0dd17e611f1b87d836250f7dc5daf8fa3
|
|
BLAKE2b-256 checksum How to use checksums |
aedbb27a0d0a98d44b859257a8949c245af8b9b59173d994b2c22d7c40971d6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.7
|
Release files / nqdb-0.1.0-py3-none-any.whl
| Download URL | nqdb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c48c2a39e1a66ae88ac795e2f0b649b3212f3d34e90bfdbf04b211a9e3cfe6e2
|
|
BLAKE2b-256 checksum How to use checksums |
3a8b4e828fe60950cf744909f58c696725f7ba3755a590a40ccd3b4002b4c40c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.7
|
Security for nqdb 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.