python orm风格的amazon(aws)dynamodb接口,使用示意图或marshmallow进行模式验证

dynamallow的Python项目详细描述


dynamodb+棉花糖==dynamallow

https://img.shields.io/travis/borgstrom/dynamallow.svghttps://img.shields.io/codecov/c/github/borgstrom/dynamallow.svgLatest PyPI versionNumber of PyPI downloads

此程序包正在进行中-欢迎反馈/建议/etc!

两件很棒的事,一起更好!

dynamallow是一个python库,它提供了Boto v3 DynamoDB APIMarshmallow之间的集成。 它们一起为DynamoDB服务提供了一个简单的、受orm启发的接口,该接口具有完全定义的强类型 架构。

fromdynamallowimportMarshModelfrommarshmallowimportfieldsclassBook(MarshModel):classTable:name='prod-books'hash_key='isbn'read=25write=5classSchema:isbn=fields.String(validate=validate_isbn)title=fields.String()author=fields.String()publisher=fields.String()year=fields.Number()# Store new documents directly from dictionariesBook.put({"isbn":"12345678910","title":"Foo","author":"Mr. Bar","publisher":"Publishorama"})# Work with the classes as objects# You can pass attributes from the schema to the constructorfoo=Book(isbn="12345678910",title="Foo",author="Mr. Bar",publisher="Publishorama")foo.save()# Or assign attributesfoo=Book()foo.isbn="12345678910"foo.title="Foo"foo.author="Mr. Bar"foo.publisher="Publishorama"foo.save()# In all cases they go through Schema validation, calls to# .put or .save can result in ValidationError being raised.# You can then fetch, query and scan your tables.# Get on the hash key, and/or range keyBook.get(isbn="12345678910")# Query based on the keysBook.query(isbn__begins_with="12345")# Scan based on attributesBook.scan(author="Mr. Bar")Book.scan(author__ne="Mr. Bar")

文档

完整的文档可以在网上找到:

http://borgstrom.github.io/dynamallow/

待办事项

  • 索引-目前不支持索引。
  • 架构迁移
  • save()
  • 上的部分更新

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
具有x86javapath的x64机器上x86java上的java JNI未满足链接错误   java将Pixmap的一部分上传到GPU   图像Java位图RLE8格式   java Android studio谷歌广告崩溃应用程序   java如何创建包含未知数量对象的变量?   Java计算给定int数组的所有可能组合   java JDBC classnotfound异常   httpclient中的java将HttpEntity转换为字符串的最优雅/正确的方法是什么?   如何从Java程序运行nano?   java在安卓中调用自定义类/方法   调用方法和JOptionPane后,允许代码继续执行所需的java计时器或其他想法   关于侦听器的向量Java并发问题   线程池执行器Java线程池   java配置DTO上的Swagger javax验证约束   Java中用于按钮功能的swing操作命令   ServletOutputStream中的java设置状态代码   java打印输入数组的平均值