Better ORM wrapper of leancloud storage python sdk.
Project description
leancloud-better-storage-python
更优雅且 pythonic 的方式使用 leancloud storage。
:construction: 施工中,文档也没有。有意参与或者疑问就开个 issue,看到回复。
快速开始
以一系列最简单的例子来说明使用方式。
模型声明
from leancloud_better_storage.storage.models import Model
from leancloud_better_storage.storage.fields import Field
class Product(Model):
name = Field('product_name', nullable=False)
price = Field(nullable=False)
field3 = Field(nullable=False, default=1)
CRUD
创建和保存
product = Product.create(name='FirstProduct',price=100)
product.commit()
查找
代码仅演示查询语法
products = Product\
.query()\
.filter_by(name='LastProduct', price=100)\
.and_()\
.filter(Product.other_field > 10, Product.other_field < 100)\
.or_()\
.filter(Product.other_field < 10, Product.other_field > -10)\
.order_by(Product.created_at.asc)\
.find(skip=10, limit=100) # also support first(), count()
更新
product = Product.query().filter_by(name='FirstProduct').first()
product.name = 'LastProduct'
product.commit()
删除
product = Product.query().filter_by(name='FirstProduct').first()
product.drop()
Project details
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
Close
Hashes for leancloud-better-storage-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba092656c301479a4da5eb598ce2d54632677f73e5225db89f5747b25b678ac4 |
|
MD5 | 4e0c43617536e89022518f0a70b3d017 |
|
BLAKE2b-256 | b83e37d69d7d79ec72d182ae4eae370f38f87a53770c67c05d1c0bfb0e91b0a0 |
Close
Hashes for leancloud_better_storage-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da7ea93e985c78caaeeff1a18c27696d7f6dc515f3cc88d3d77e54ee7480b2fd |
|
MD5 | e3dbc5de3e67ba468b6f4ccd6d2b5352 |
|
BLAKE2b-256 | 20b70882f98482e5ab0d433535ad91c5b653da937d6a5482e1507f6fa99325f2 |