Skip to main content

Firestore + Dataclass: declare and interact with your Firestore models using dataclasses.

Project description


Python Version PyPi Version Build Status

Firestore + Dataclass: declare and interact with your Firestore models using Python dataclasses.


pip install fireclass

Sample usage

from dataclasses import dataclass
from enum import Enum

from import firestore
from fireclass import Document, initialize_with_firestore_client

class MembershipLevelEnum(Enum):
    NONE = 1
    FULL = 3

# Define a new type of document as a 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")

# Create a new person
person = Person(email_address="", age=30, membership=MembershipLevelEnum.INTERMEDIATE)

# Save the person to the DB

# Update some fields
person.age = 31
person.membership = MembershipLevelEnum.NONE

# Fetch this specific person
fetched_person = Person.get_document(

# Query for persons
for found_person in Person.where("age", "==", 31).stream():

# Delete the document from the DB

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

fireclass-1.0.4.tar.gz (5.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page