A Python Redis ORM
Project description
Status
Documentation: popoto.readthedocs.io
Popoto - A Redis ORM (Object-Relational Mapper)
Install
pip install popoto
Basic Usage
from popoto import Model, KeyField, Field
class Person(Model):
name = KeyField()
fav_color = Field()
Person.create(name="Lalisa Manobal", fav_color = "yellow")
lisa = Person.query.get(name="Lalisa Manobal")
print(f"{lisa.name} likes {lisa.fav_color}.")
> 'Lalisa Manobal likes yellow.'
Popoto Features
- very fast stores and queries
- familiar syntax, similar to Django models
- Geometric distance search
- Timeseries for streaming data
- compatible with Pandas, Xarray for N-dimensional matrix search 🚧
- PubSub for message queues, streaming data processing
Popoto is ideal for streaming data. The pub/sub module allows you to trigger state updates in real time. Currently being used in production for:
- trigger buy/sell actions from streaming price data
- robots sending each other messages for teamwork
- compressing sensor data and training neural networks
Advanced Usage
import popoto
class Person(popoto.Model):
uuid = popoto.AutoKeyField()
username = popoto.UniqueKeyField()
title = popoto.KeyField()
level = popoto.SortedField(type=int)
last_active = popoto.SortedField(type=datetime)
location = popoto.GeoField()
invited_by = popoto.Relationship(model=Person)
Save Instances
lisa = Person(username="@LalisaManobal")
lisa.title = "Queen"
lisa.level = 99
lisa.location = (48.856373, 2.353016) # Hôtel de Ville, Fashion Week 2021
lisa.last_active = datetime.now()
lisa.save()
Queries
paris_lat_long = (48.864716, 2.349014)
yesterday = datetime.now() - timedelta(days=1)
query_results = Person.query.filter(
title__startswith="Queen",
level__lt=100,
last_active__gt=yesterday,
location=paris_lat_long,
location_radius=5, location_radius_unit='km'
)
len(query_results)
>>> 1
print(query_results)
>>> [{
'uuid': 'f1063355b14943ed91fa1e1697806c4f',
'username': '@LalisaManobal',
'title': 'Queen',
'level': 99,
'last_active': datetime.datetime(2021, 11, 21, 14, 47, 19, 911023),
'location': (48.856373, 2.353016)
}, ]
lisa = query_results[0]
lisa.delete()
>>> True
Documentation
Documentation is available at popoto.readthedocs.io
Please create new feature and documentation related issues github.com/tomcounsell/popoto/issues or make a pull request with your improvements.
License
Popoto ORM is released under the MIT Open Source license.
Popoto Community
Please post your questions on Stack Overflow.
Popoto gets it's name from the Māui dolphin subspeciesis - the world's smallest dolphin subspecies. Because dolphins are fast moving, agile, and work together in social groups. In the same way, Popoto wraps Redis and RedisGraph to make it easy to manage streaming timeseries data on a social graph.
For help building applications with Python/Redis, contact Tom Counsell on LinkedIn.com/in/tomcounsell
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file popoto-0.9.0.tar.gz.
File metadata
- Download URL: popoto-0.9.0.tar.gz
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e41081d2892b9aa3c89f4c964e721f32b077bd2081332b4a82b2a424ec99730
|
|
| MD5 |
ab87f668c1e581678ea5283a33a8c959
|
|
| BLAKE2b-256 |
3530c04c1dbb8e76896ce2d4b4a2bfd2acfba8982cced706df6692a90c269172
|
Provenance
The following attestation bundles were made for popoto-0.9.0.tar.gz:
Publisher:
release.yml on tomcounsell/popoto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
popoto-0.9.0.tar.gz -
Subject digest:
9e41081d2892b9aa3c89f4c964e721f32b077bd2081332b4a82b2a424ec99730 - Sigstore transparency entry: 891597415
- Sigstore integration time:
-
Permalink:
tomcounsell/popoto@ac10c3dd13dadb08f8b5c00c52110a3c90d48cd6 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/tomcounsell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ac10c3dd13dadb08f8b5c00c52110a3c90d48cd6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file popoto-0.9.0-py3-none-any.whl.
File metadata
- Download URL: popoto-0.9.0-py3-none-any.whl
- Upload date:
- Size: 38.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bcc02eb327b32aec4ea5af78c153ba3a62881e0bebf1da072cc278dc3bdc2bc
|
|
| MD5 |
e6bcc5c7f7b370abd8edf4e6c2e80b90
|
|
| BLAKE2b-256 |
fc7e00690adb0ae281d0e49f49ffa9a876eeb7913cd1cb3ac2633a1ec93971f7
|
Provenance
The following attestation bundles were made for popoto-0.9.0-py3-none-any.whl:
Publisher:
release.yml on tomcounsell/popoto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
popoto-0.9.0-py3-none-any.whl -
Subject digest:
2bcc02eb327b32aec4ea5af78c153ba3a62881e0bebf1da072cc278dc3bdc2bc - Sigstore transparency entry: 891597463
- Sigstore integration time:
-
Permalink:
tomcounsell/popoto@ac10c3dd13dadb08f8b5c00c52110a3c90d48cd6 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/tomcounsell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ac10c3dd13dadb08f8b5c00c52110a3c90d48cd6 -
Trigger Event:
push
-
Statement type: