Skip to main content

Object wrapper for dbms

Project description

Installation

$ pip install odbm

Usage

>>> from datetime import datetime
>>> import odbm

>>> class User(odbm.Model):
...     username = odbm.UnicodeProperty(primary_key=True)
...     friends  = odbm.Property(default=[], key='f')
...     created  = odbm.DateTimeProperty(key='c')
...
...     __backend__ = staticmethod(lambda: dict())

>>> User(
...     username = 'foo',
...     friends  = ['bar', 'baz'],
...     created = datetime.now(),
... ).save()
>>> User(username='bar', created = datetime.now()).save()
>>> User(username='baz', created = datetime.now()).save()

>>> User.get('foo').friends
['bar', 'baz']

>>> [u.username for u in User.find(
...     filter  = lambda u: not u.friends,
...     order   = lambda x: x.created)]
[u'bar', u'baz']

>>> User.count()
3
>>> User.count(lambda u: 'baz' in u.friends)
1
>>> User.find_one().delete()
>>> User.count()
2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odbm-0.5.6.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file odbm-0.5.6.tar.gz.

File metadata

  • Download URL: odbm-0.5.6.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for odbm-0.5.6.tar.gz
Algorithm Hash digest
SHA256 c4ca8c7d259a7c2fe751b35ce4d691612b35c8fca070fa28c0098558594f4408
MD5 f02677d0ef842c8fc7b2b0e37eb6fe60
BLAKE2b-256 8ed6c8114959dd1b9bb94a25a39547b175ea74935110da28305da73fa2cf68de

See more details on using hashes here.

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