Pydantic models for Firestore
Project description
Pyrodantic
Pydantic models for Google Firestore.
Inspired by fireclass.
Installation
pip install pyrodantic
Usage
from google.cloud.firestore import Client
from pyrodantic import Document, FirestoreID
firestore_client = Client()
class TestDocument(Document):
document_id: FirestoreID = None
test_string: str
test_int: int
test_default: str = 'default'
class Firestore:
collection = 'test-collection'
doc = TestDocument(firestore_client, test_string='foo', test_int=1)
# doc == TestDocument(document_id=None, test_string='foo', test_int=1, test_default='default')
doc.create()
# doc == TestDocument(document_id='4f7be295accc473aa87844ec6f98443c', test_string='foo', test_int=1, test_default='default')
doc = TestDocument.get('4f7be295accc473aa87844ec6f98443c', firestore_client=firestore_client)
# doc == TestDocument(document_id='4f7be295accc473aa87844ec6f98443c', test_string='foo', test_int=1, test_default='default')
docs = list(TestDocument.where('test_string', '==', 'foo', firestore_client).stream())
# docs[0] == TestDocument(document_id='4f7be295accc473aa87844ec6f98443c', test_string='foo', test_int=1, test_default='default')
docs[0].delete()
doc = TestDocument.get('4f7be295accc473aa87844ec6f98443c', firestore_client=firestore_client)
# doc == None
TODO
- Support transactions
- Support sub-collections
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyrodantic-0.0.4.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrodantic-0.0.4.tar.gz.
File metadata
- Download URL: pyrodantic-0.0.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aff49e8f999878cac46b131482ad002ecc0f81885d06599adf1e782c3e9eb8d2
|
|
| MD5 |
30978b6f96677bbac20e91f90e7de492
|
|
| BLAKE2b-256 |
cf4a4a7904388e03c144ba61b1998f3f6d73c5b6f1817fef012082508ea53a0b
|
File details
Details for the file pyrodantic-0.0.4-py3-none-any.whl.
File metadata
- Download URL: pyrodantic-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d74cfe6d723a41bce32975da780579a673239d4590594ea1e92ab6e890b9e318
|
|
| MD5 |
67ad0eeadc0275dfe6cb315fb27d67ba
|
|
| BLAKE2b-256 |
9677a673752e3ffabc6fa995dfb3f300f5ad2938168066e4cb517bf59a18dd12
|