Object-Relational Mapping (ORM)
Project description
Tentacles is a python ORM. The main idea is to manipulate stored datas as you do for python data structures
python native:
>>> class SuperHero(object): >>> def __init__(self, name, gender, power): >>> self.name = name >>> self.gender = gender >>> self.power = power >>> >>> hero1 = SuperHero('superman', 'male', 'flight') >>> print "%s can %s" % (hero1.name, hero1.power)
… vs tentacles …:
>>> from tentacles import Object >>> from tentacles.fields import * >>> class SuperHero(Object): >>> name = String() >>> gender = String() >>> power = String() >>> >>> hero1 = SuperHero(name='superman', gender='male', power='flight') >>> print "%s can %s" % (hero1.name, hero1.power)
python native:
>>> heros = [hero1, SuperHero(name='wonder woman', gender='female', power='enhanced vision')] >>> females = filter(lambda e: e.gender = 'female', heros) >>> for e in females: >>> print "superheroine: %s" % e.name
… vs tentacles …:
>>> hero1.save(); SuperHero(name='wonder woman', gender='female', power='enhanced vision').save() >>> females = filter(lambda e: e.gender = 'female', heros) >>> for e in females: >>> print "superheroine: %s" % e.name
Tentacles is pretty yound and incomplete, and still in alpha stage. It currently support only sqlite3 backend, while more are scheduled at mid-term (mysql, postgresql, but also no-sql storages, like openldap, mongodb, …)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tentacles-0.1.1.tar.gz
(42.4 kB
view details)
File details
Details for the file tentacles-0.1.1.tar.gz
.
File metadata
- Download URL: tentacles-0.1.1.tar.gz
- Upload date:
- Size: 42.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90849b07ae6eb53b485ae805f6f86a71c0d098c9cd3687b00e943928b1858d6e |
|
MD5 | d5e7e55e528dbd0d9811a0ddf7dfafc6 |
|
BLAKE2b-256 | c604047742b2527651b80a4775c2e3bad200b08b4d3b9adb965a699594510432 |