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 Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page