Skip to main content

Better ORM wrapper of leancloud storage python sdk.

Project description

leancloud-better-storage-python

travis-ci codecov

更优雅且 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

leancloud-better-storage-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

leancloud_better_storage-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file leancloud-better-storage-0.1.0.tar.gz.

File metadata

  • Download URL: leancloud-better-storage-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for leancloud-better-storage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ba092656c301479a4da5eb598ce2d54632677f73e5225db89f5747b25b678ac4
MD5 4e0c43617536e89022518f0a70b3d017
BLAKE2b-256 b83e37d69d7d79ec72d182ae4eae370f38f87a53770c67c05d1c0bfb0e91b0a0

See more details on using hashes here.

File details

Details for the file leancloud_better_storage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: leancloud_better_storage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for leancloud_better_storage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da7ea93e985c78caaeeff1a18c27696d7f6dc515f3cc88d3d77e54ee7480b2fd
MD5 e3dbc5de3e67ba468b6f4ccd6d2b5352
BLAKE2b-256 20b70882f98482e5ab0d433535ad91c5b653da937d6a5482e1507f6fa99325f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page