Skip to main content

Simple python ORM micro-framework for sqlite3

Project description

litesimple
==========

Litesimple is a simple ORM micro-library for sqlite3. It offers mapping
between attributes (or fields as it's named here) to table columns with
conversion support from different formats, querying, saving and other simple
task.

Installation and dependencies
-----------------------------

To install litesimple, either run ``pip install litesimple`` or download [litesimple.py](https://github.com/TheThing/litesimple) directly in your browser or with wget.

Litesimple has no dependancy requirements other than is included in the Python Standard Library.

Example
-------

First create your models:

``` python
from litesimple import Model, FieldInteger, FieldText, FieldDateTime

class car(Model):
id = FieldInteger(is_key=True)
text = FieldText()
time_created = FieldDateTime(auto_now_add=True)
time_updated = FieldDateTime(auto_now=True)

def __str__(self):
return "car (%s)" % self.make
```

Then play with it:

``` python
>>> from models import car
>>> car(make="Opel").save()
>>> car(make="Hyundai").save()
>>> car(make="BMW").save()
>>> print car.get(1)
car (Opel)
>>> for x in car.filter(): print x
queue (Opel)
queue (Hyundai)
queue (BMW)
>>> c = car.get(2)
>>> print c
car (Hyundai)
>>> c = car.get(id=2)
>>> print c
car (Hyundai)
>>> c.delete()
>>> for x in car.filter(): print x
car (Opel)
car (BMW)
>>> car.delete(make="Opel")
>>> for x in car.filter(): print x
car (BMW)
```

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

litesimple-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file litesimple-0.1.0.tar.gz.

File metadata

  • Download URL: litesimple-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for litesimple-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1501502226ca32927eadbae7ada8afb299c390c697a2c5bd166ecf081db1ef8
MD5 d2b243b23d7b7744f64d972734a7804a
BLAKE2b-256 ed36f0a5732c450a1a75403bfe3b47569933214b52e92068e6d40be21222b3d8

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