Skip to main content

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, …)

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 hashes)

Uploaded Source

Supported by

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