Firedom
Simple Firestore ORM for Python.
Installation
pip install firedom
Getting started
Initialize Firedom
from firedom import Firedom
firedom = Firedom(service_account_json_path='your-credentials.json')
Define your models
Create a model for your Firestore collection by inheriting from Model:
from dataclasses import dataclass
from firedom import Firedom
firedom = Firedom(service_account_json_path='your-credentials.json')
@dataclass
class Company(firedom.Model):
name: str
@dataclass
class User(firedom.Model):
username: str
email: int
country: str
city: str
is_active: bool = True
number_of_pets: int = 0
company: Company
class Config:
# Required: Field to be used as document ID
document_id_field = 'username'
Manipulate documents
Create
company = Company.collection.create(name='Example Company')
user = User.collection.create(
username='afuenzalida',
email='afuenzalida@example.com',
country='Chile',
city='Santiago',
company=company,
)
Retrieve
users = User.collection.all()
user = User.collection.get('afuenzalida')
Filter
# All arguments are considered as AND:
users = User.collection.where(
User.country == 'Chile',
User.is_active == True,
User.city.is_in(['Santiago', 'Valparaíso']),
User.number_of_pets > 1,
)
# You can filter with OR using the | operator:
users = User.collection.where(
(User.country == 'Chile') |
(User.country == 'China'),
)
# And you can also filter explicitly with AND using the & operator:
users = User.collection.where(
(User.city == 'Santiago') &
(User.number_of_pets == 0),
)
# Full example: Filter by active users from Chile or China:
users = User.collection.where(
(User.is_active == True) &
(
(User.country == 'Chile') |
(User.country == 'China')
),
)
Sort
users = User.collection.where(
User.country == 'Chile',
).order_by(
'email',
desc=True,
)
Update
user = User.collection.get('afuenzalida')
user.country = 'Australia'
user.save()
Delete
user = User.collection.get('afuenzalida')
user.delete()
User.collection.all().delete()
Metadata
Release files for firedom 1.3.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 |
|---|---|---|---|---|
| firedom-1.3.0.tar.gz | 8.5 kB | Without provenance | Details for firedom-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| firedom-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for firedom-1.3.0-py3-none-any.whl |
Total release size: 16.2 kB
Release files / firedom-1.3.0.tar.gz
| Download URL | firedom-1.3.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb5ce9dd7a218a43abe3cde96e82540830975488568328f5b40a3cca19daab36
|
|
BLAKE2b-256 checksum How to use checksums |
ff48ce7e915b5b5b102ac1f874ca351d7c84654bfd549a564ef3dbc0e502eff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / firedom-1.3.0-py3-none-any.whl
| Download URL | firedom-1.3.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57be8720d571775cf3f1d4fe0e65a50f4006b5b46cae9fbbc204992131f213d5
|
|
BLAKE2b-256 checksum How to use checksums |
d785e872f5349c9ce3bddc4cf073386ebdebecc94a10697bc2295c795d4c8101
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for firedom 1.3.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.