Object wrapper for dbms
Project description
Installation
$ pip install odbm
Usage
>>> class Test(Model): ... day = DateProperty(primary_key=True) ... foo = Property(default=[1, 2]) ... ustr = UnicodeProperty(key='u') ... cstr = CompressedStringProperty() ... cuni = CompressedUnicodeProperty() ... cdump = CompressedProperty(default={}) ... created = DateTimeProperty(key='c') ... ... __db_type__ = 'dict'>>> Test( ... day = date(2000, 01, 02), ... foo = [1, u'ы', {'a': 'b'}], ... ustr = u'ыыы', ... cstr = 'A' * 1000, ... cuni = u'Ы' * 1000, ... cdump = range(10), ... created = datetime.now(), ... ).save() >>> Test(day=date(1999, 02, 02)).save()>>> Test.get(date(1999, 02, 02)).foo [1, 2]>>> Test.count() 2 >>> Test.count(lambda x: x.ustr == u'ыыы') 1>>> [t.day.year for t in Test.find( ... filter = lambda x: 3 not in x.foo, ... order = lambda x: x.day)] [1999, 2000]>>> Test.find_one().delete() >>> Test.count()
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
odbm-0.3.tar.gz
(4.5 kB
view hashes)