firestore-model
Quickly and simply create model classes for Google's Cloud Firestore schemaless database.
Overview
This project seeks to provide a similar convenience and utility for using Cloud Firestore with the newly available Python 3.7 App Engine Envinronment as the NDB client library does for using Cloud Datastore with Python 2.7 App Engine.
Example
import firestore_model
from google.firestore import firestore
from filestore_model import Model, Query
# initialize the database connection globally for Firestore Model
firestore_model.db = firestore.Client()
# Define a data structure for a User
@dataclass
class User(Model):
first_name:str
last_name:str
occupation:str
# Create a new user, pass save = True to automagically save the model object
u1 = User.make(
first_name='Sonic',
last_name='Brown',
occupation='circus dog'
save=True
)
# Fetch all users that match a given query
users = User.query([
('occupation', 'circus dog'),
('created', '>', 1540776978)
]
).get()
# Iterate through the results of the query
for u in users:
print(u.id, u.created, u.first_name, u.last_name, u.occupation)
Release files for firestore-model 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firestore_model-0.0.3.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| firestore_model-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / firestore_model-0.0.3.tar.gz
| Download URL | firestore_model-0.0.3.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d265223522c771bdc9b2f751ec833359d1d3e963d2dd10c69ebe411966f09c3f
|
|
BLAKE2b-256 checksum How to use checksums |
5eaa7b5f094375fa9d59a1e3dbbf9a66246ee3e9334cc799d2a6442aa9a089b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Release files / firestore_model-0.0.3-py3-none-any.whl
| Download URL | firestore_model-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b80d9f0711efa43e376a0cba4085d0a70a0cae70063dea14abe6e6a2c60fff4
|
|
BLAKE2b-256 checksum How to use checksums |
d0de86f794d8dffbfba9d27ee1a621f14d3a32a1e15f52c4318b08ec5a7c76eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|