Skip to main content

firestore-model

Quickly and simply create model classes for Google's Cloud Firestore schemaless database.

Overview

This project seeks to provide a similar convenience and utility for using Cloud Firestore with the newly available Python 3.7 App Engine Envinronment as the NDB client library does for using Cloud Datastore with Python 2.7 App Engine.

Example

import firestore_model
from google.firestore import firestore
from filestore_model import Model, Query

# initialize the database connection globally for Firestore Model 
firestore_model.db = firestore.Client()

# Define a data structure for a User
@dataclass
class User(Model):
  first_name:str
  last_name:str
  occupation:str

# Create a new user, pass save = True to automagically save the model object
u1 = User.make(
    first_name='Sonic',
    last_name='Brown',
    occupation='circus dog'
    save=True
  )

# Fetch all users that match a given query
users = User.query([
    ('occupation', 'circus dog'), 
    ('created', '>', 1540776978)
  ]
).get()

# Iterate through the results of the query
for u in users:
  print(u.id, u.created, u.first_name, u.last_name, u.occupation)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firestore_model-0.0.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

firestore_model-0.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file firestore_model-0.0.3.tar.gz.

File metadata

  • Download URL: firestore_model-0.0.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for firestore_model-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d265223522c771bdc9b2f751ec833359d1d3e963d2dd10c69ebe411966f09c3f
MD5 5c08a86b922d9270c271ddd3016c746c
BLAKE2b-256 5eaa7b5f094375fa9d59a1e3dbbf9a66246ee3e9334cc799d2a6442aa9a089b0

See more details on using hashes here.

File details

Details for the file firestore_model-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: firestore_model-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for firestore_model-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4b80d9f0711efa43e376a0cba4085d0a70a0cae70063dea14abe6e6a2c60fff4
MD5 e3cab42d33a3af12ee0a29736f630c3b
BLAKE2b-256 d0de86f794d8dffbfba9d27ee1a621f14d3a32a1e15f52c4318b08ec5a7c76eb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.5

2 files

0.0.4

2 files

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page