Pydantic models for Firestore
Project description
Pyrodantic
Pydantic models for Google Firestore.
from google.cloud.firestore import Client
from pyrodantic.document import Document
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)
# TestDocument(document_id=None, test_string='foo', test_int=1, test_default='default')
doc.create()
# TestDocument(document_id='4f7be295accc473aa87844ec6f98443c', test_string='foo', test_int=1, test_default='default')
doc = TestDocument.get('4f7be295accc473aa87844ec6f98443c', firestore_client=firestore_client)
# TestDocument(document_id='4f7be295accc473aa87844ec6f98443c', test_string='foo', test_int=1, test_default='default')
doc.delete()
doc = TestDocument.get('4f7be295accc473aa87844ec6f98443c', firestore_client=firestore_client)
# doc == None
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.1.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for pyrodantic-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9994e34808d1ad1f44a6bec129b9d7e6c7d6e89056b3187db528ed9150e0bda |
|
MD5 | 611f00874f77c5c31decd17a31bb7b04 |
|
BLAKE2b-256 | 233f869ce74e45db8bda5240878a8159e247454dbd4dc761283567e15f7fbf57 |