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()
Metadata
Release files for leancloud-better-storage 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| leancloud-better-storage-0.1.0.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| leancloud_better_storage-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / leancloud-better-storage-0.1.0.tar.gz
| Download URL | leancloud-better-storage-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba092656c301479a4da5eb598ce2d54632677f73e5225db89f5747b25b678ac4
|
|
BLAKE2b-256 checksum How to use checksums |
b83e37d69d7d79ec72d182ae4eae370f38f87a53770c67c05d1c0bfb0e91b0a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|
Release files / leancloud_better_storage-0.1.0-py3-none-any.whl
| Download URL | leancloud_better_storage-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da7ea93e985c78caaeeff1a18c27696d7f6dc515f3cc88d3d77e54ee7480b2fd
|
|
BLAKE2b-256 checksum How to use checksums |
20b70882f98482e5ab0d433535ad91c5b653da937d6a5482e1507f6fa99325f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|