Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/21dimensions/python-client
Client for EasyEasy.io cloud database
https://github.com/21dimensions/python-client
cloud database databases easyeasy orm orm-framework storage
Last synced: about 1 month ago
JSON representation
Client for EasyEasy.io cloud database
- Host: GitHub
- URL: https://github.com/21dimensions/python-client
- Owner: 21dimensions
- Created: 2018-10-12T07:18:33.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-23T12:49:09.000Z (about 6 years ago)
- Last Synced: 2024-09-29T11:25:35.944Z (about 2 months ago)
- Topics: cloud, database, databases, easyeasy, orm, orm-framework, storage
- Language: Python
- Homepage: http://easyeasy.io/
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# easyeasy.client
## How to use
### Install
```
pip install easyeasy
```### Initialize
```python
from easyeasy.client import Clientclient = Client("bc420813-17d9-47fa-9d29-8bd6a1207f8a")
```### Examples
```python
class Cat:
def __init__(self):
self.id = None
self.name = None
self.interests = []
self.age = Nonecat = Cat()
cat.name = "Sam"
cat.age = 1.5
cat.interests = ["play", "eat", "discover"]# add object. entity name will be inferred from class name
id = client.add(cat)# or specify entity name explicitly
id = client.add(cat, "cat")# get one object by id. Specify entity type. Entity name will be inferred
cat = client.get_one(id, Cat)# or specify entity name explicitly
cat = client.get_one(id, Cat, "cat")
# at least one should be specified(entity_class or entity_name). In case entity_class not specified, dict object will be returned# update object
cat.age = 2.0
cat.interests = ["eat", "sleep", "play"]# object must have id property to distinguish which object is being updated. entity_name can be specified explicitly
client.update(cat)# get all objects. entity_name can be specified explicitly
cats_collection = client.get(Cat)# filtering
cats_collection = client.get(Cat, query={'age': 1.5}) # get 1.5 years old cats
cats_collection = client.get(Cat, query={'age_gt': 1.0}) # cats older than 1 year
cats_collection = client.get(Cat, query={"name_like": "Sa*"}) # wildcard# paging
cats_collection = client.get(Cat, query={"_start": "10", "_count": 10})# ordering
cats_collection = client.get(Cat, query={"_orderby":"age"})
cats_collection = client.get(Cat, query={"_orderbydesc":"age"})# learn more about filtering operators at: http://easyeasy.io/docs#/operators
# delete object by id
client.delete(cat.id, Cat)
```# Licence
ISC