# Example:
from active_redis import ActiveRedis, ActiveRedisModel, UUIDGenerator
class Movie(ActiveRedisModel):
stored_attrs = ['title', 'year', 'author']
def __init__(self, uuid, title, year, author):
self.uuid = uuid
self.title, self.year, self.author = title, year, author
if __name__ == '__main__':
ActiveRedis.config = {
'connexion': {'db': 3},
'namespace_prefix': 'mycinema'
}
assert Movie.delete_all()
assert 0, Movie.count()
topgun = Movie(UUIDGenerator.generate(), 'TopGun', 1987, 'Tony S.')
assert topgun.save()
titanic = Movie(UUIDGenerator.generate(), 'Titanic', 1997, 'James C.')
assert titanic.save()
topgun.update_attr('title', 'Top Gun')
assert 'Top Gun', Movie.find(topgun.uuid).title
assert 2, Movie.count()
assert 2, len(Movie.find_all())
m = Movie.find(topgun.uuid)
m.delete()
assert 1, Movie.count()
assert 1, len(Movie.find_all())
from active_redis import ActiveRedis, ActiveRedisModel, UUIDGenerator
class Movie(ActiveRedisModel):
stored_attrs = ['title', 'year', 'author']
def __init__(self, uuid, title, year, author):
self.uuid = uuid
self.title, self.year, self.author = title, year, author
if __name__ == '__main__':
ActiveRedis.config = {
'connexion': {'db': 3},
'namespace_prefix': 'mycinema'
}
assert Movie.delete_all()
assert 0, Movie.count()
topgun = Movie(UUIDGenerator.generate(), 'TopGun', 1987, 'Tony S.')
assert topgun.save()
titanic = Movie(UUIDGenerator.generate(), 'Titanic', 1997, 'James C.')
assert titanic.save()
topgun.update_attr('title', 'Top Gun')
assert 'Top Gun', Movie.find(topgun.uuid).title
assert 2, Movie.count()
assert 2, len(Movie.find_all())
m = Movie.find(topgun.uuid)
m.delete()
assert 1, Movie.count()
assert 1, len(Movie.find_all())
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
active_redis-0.0.1.tar.gz
(2.8 kB
view details)
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 active_redis-0.0.1.tar.gz.
File metadata
- Download URL: active_redis-0.0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d07e3b8f197bcc56580867a5d3a01a402d7e09d596ff7c2c50ea974196332219
|
|
| MD5 |
1bc4ad1ce769282f8124ce7f180f74cf
|
|
| BLAKE2b-256 |
8b79bfa0e7783860cc0f1dc8508f7faca1fdb92ceafb294f3b19223457ea944d
|
File details
Details for the file active_redis-0.0.1.macosx-10.4-x86_64.exe.
File metadata
- Download URL: active_redis-0.0.1.macosx-10.4-x86_64.exe
- Upload date:
- Size: 67.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
286c2a40fb811dd825a72f9abf240d3e7b8e606fdc505481ed7cba5f02afe03e
|
|
| MD5 |
4b5f311f8aae43dc9aae42433420f720
|
|
| BLAKE2b-256 |
b1f81fffe600c52a9c801ee22abfebb050a46c6f46a65c4492e464e6d340823e
|