Skip to main content

PyPI Version Build Status

redis-astra

Redis-astra is Python light ORM for Redis.

Note: version 2 has uncomportable changes with version 1. See CHANGELOG.txt

Example:

import redis
from astra import models

db = redis.StrictRedis(host='127.0.0.1', decode_responses=True)

class SiteObject(models.Model):
    def get_db(self):
        return db

    name = models.CharHash()

class UserObject(models.Model):
    def get_db(self):
        return db

    name = models.CharHash()
    login = models.CharHash()
    site = models.ForeignKey(to=SiteObject)
    sites_list = models.List(to=SiteObject)
    viewers = models.IntegerField()

    def save(self, action, attr=None, value=None):
        print('\t * %s' % kwargs)

So you can use it like this:

>>> user = UserObject(pk=1, name="Mike", viewers=5)
    * {'action': 'post_init', 'value': {'name': 'Mike', 'viewers': 5}}
>>> user.login = 'mike@null.com'
    * {'action': 'pre_assign', 'attr': 'login', 'value': 'mike@null.com'}
        * {'action': 'post_assign', 'attr': 'login', 'value': 'mike@null.com'}
>>> user.login
'mike@null.com'
>>> user.viewers_incr(2)
7
>>> site = SiteObject(pk=1, name="redis.io")
>>> user.site = site
    * {'attr': 'site', 'action': 'm2m_link', 'value': <Model SiteObject(pk=1)>}
>>> user.sites_list.lpush(site, site, site)
3
>>> len(user.sites_list)
3
>>> user.sites_list[2].name
'redis.io'
>>> user.site = None
        * {'attr': 'site', 'action': 'm2m_remove'}
>>> user.remove()
    * {'action': 'pre_remove', 'attr': 'pk', 'value': '1'}
    * {'action': 'post_remove', 'attr': 'pk', 'value': '1'}

Install

Python versions 2.6, 2.7, 3.3, 3.4, 3.5 are supported Redis-py versions >= 2.9.1

pip install redis-astra

Metadata

Release files for redis-astra 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redis-astra 2.0.0
File Size Uploaded Provenance
redis-astra-2.0.0.zip 12.0 kB Without provenance Details

Release files / redis-astra-2.0.0.zip

Download URL redis-astra-2.0.0.zip
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
066bcffb678a737b376f4bff297f753103334cf9da5eb55d0b0c8d03c1dbd102
BLAKE2b-256 checksum
How to use checksums
887cef76c0be4ddc1bd6d80729edce20bd32d02857a7894305bee83205cb5b60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for redis-astra 2.0.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.

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