百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
K

kev

> 数据库
开源

K.E.V. (键、附加项和值)是基于 Valley 的键值存储的 Python ORM。目前支持的后端包括 Redis、S3 和 S3/Redis 混合后端。

99 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

K.E.V. (键、附加项和值)是基于 Valley 的键值存储的 Python ORM。目前支持的后端包括 Redis、S3 和 S3/Redis 混合后端。

kev

K.E.V. (Keys, Extra Stuff, and Values) is a Python ORM for key-value stores and document databases based on Valley. Currently supported backends are Redis, S3 and a S3/Redis hybrid backend.

Python Versions

Kev should work on Python 3.5+ and higher

Install

bash
pip install kev

Example Project Using KEV

  • flask-capless-blog

Example Usage

Setup the Connection

Example: loading.py

…

Setup the Models

Example: models.py

…

Use the model

How to Save a Document

python
>>>from .models import TestDocument

>>>kevin = TestDocument(name='Kev',is_active=True,no_subscriptions=3,state='NC',gpa=3.25)

>>>kevin.save()

>>>kevin.name
'Kev'

>>>kevin.is_active
True

>>>kevin.pk
ec640abfd6

>>>kevin.id
ec640abfd6

>>>kevin._id
'ec640abfd6:id:s3redis:testdocument'

Query Documents

First Save Some More Docs
python

>>>george = TestDocument(name='George',is_active=True,no_subscriptions=3,gpa=3.25,state='VA')

>>>george.save()

>>>sally = TestDocument(name='Sally',is_active=False,no_subscriptions=6,gpa=3.0,state='VA')

>>>sally.save()
Show all Documents
python
>>>TestDocument.objects().all()

[,,]

>>>TestDocument.objects().all(skip=1)

[,]

>>>TestDocument.objects().all(limit=2)

[,]
Get One Document
python
>>>TestDocument.get('ec640abfd6')

>>>TestDocument.objects().get({'state':'NC'})
Filter Documents
python
>>>TestDocument.objects().filter({'state':'VA'})

[,]

>>>TestDocument.objects().filter({'no_subscriptions':3})
[,]

>>>TestDocument.objects().filter({'no_subscriptions':3,'state':'NC'})
[]
Sort Documents
python
>>>TestDocument.objects().filter({'no_subscriptions':3}).sort_by('name')
[, ]
>>>TestDocument.objects().filter({'no_subscriptions':3}).sort_by('name', reverse=True)
[, ]
>>>TestDocument.objects().all().sort_by('gpa')
[, , ]
TestDocument.objects().all().sort_by('name').sort_by('gpa')
[, >, >>TestDocument.objects().filter({'no_subscriptions':3}).filter({'state':'NC'})
[]
Wildcard Filters

Wildcard filters currently only work with the Redis and S3/Redis backend. Use prefixes with the S3 backend.

python
>>>TestDocument.objects().filter({'state':'N*'})
[]
Prefix Filters

Prefix filters currently only work with the S3 backend. Use wildcard filters with the Redis or S3/Redis backends.

python
>>>TestDocument.objects().filter({'state':'N'})
[]

Backup and Restore

Easily backup or restore your model locally or from S3. The backup method creates a JSON file backup.

Backup

Local Backup
python
TestDocument().backup('test-backup.json')
S3 Backup
python

TestDocument().backup('s3://your-bucket/kev/test-backup.json')

Restore

Local Restore
python

TestDocument().restore('test-backup.json')

S3 Restore

python

TestDocument().restore('s3://your-bucket/kev/test-backup.json')

Author

Twitter::@brianjinwright Github: bjinwright

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonormrediss3

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库