Fireclass
Firestore + Dataclass: declare and interact with your Firestore models using Python dataclasses.
Installation
pip install fireclass
Sample usage
from dataclasses import dataclass
from enum import Enum
from google.cloud import firestore
from fireclass import Document, initialize_with_firestore_client
class MembershipLevelEnum(Enum):
NONE = 1
INTERMEDIATE = 2
FULL = 3
# Define a new type of document as a dataclass
@dataclass
class Person(Document):
email_address: str
age: int
# Enum fields are supported
membership: MembershipLevelEnum
# Initialize access to the Firestore DB
client = firestore.Client.from_service_account_json("travis-ci-test-suite-service-account.json")
initialize_with_firestore_client(client)
# Create a new person
person = Person(email_address="test@test.com", age=30, membership=MembershipLevelEnum.INTERMEDIATE)
# Save the person to the DB
person.create()
# Update some fields
person.age = 31
person.membership = MembershipLevelEnum.NONE
person.update()
# Fetch this specific person
fetched_person = Person.get_document(person.id)
# Query for persons
for found_person in Person.where("age", "==", 31).stream():
print(found_person)
# Delete the document from the DB
person.delete()
Metadata
Release files for fireclass 1.0.4
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 |
|---|---|---|---|---|
| fireclass-1.0.4.tar.gz | 5.0 kB | Without provenance | Details for fireclass-1.0.4.tar.gz |
Release files / fireclass-1.0.4.tar.gz
| Download URL | fireclass-1.0.4.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02ef392e542e07d33a3b1a2b6c74e6b525e7b761e9b6a4958ab13f9143ac47b1
|
|
BLAKE2b-256 checksum How to use checksums |
82b8d7b4ab22c22be1832468351d6a48d9edf9de9dbc6b12171376bac634e700
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4
|
Security for fireclass 1.0.4
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.