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.0.tar.gz
(31.9 kB
view hashes)