Macaron is a Python module which is a simple Object-Relational Mapper for SQLite.

External Resources

Installation

Install Macaron with easy_install macaron or download the source package at PyPI.

Sources

Browse the sources at GitHub.

This Page

Macaron: Python O/R Mapper

Documentation in Japanese is available at BioKids.

Macaron is a small and simple object-relational mapper (ORM) for SQLite. It is distributed as a single file module which has no dependencies other than the Python Standard Library.

Macaron provides easy access methods to SQLite database. And it supports Bottle web framework through plugin mechanism. See Macaron for Web Applications.

Example:

>>> import macaron
>>> macaron.macaronage(dbfile="members.db")
>>> team = Team.create(name="Houkago Tea Time")
>>> team.members.append(name="Azusa", part="Gt2")
<Member object 1>
>>> macaron.bake()
>>> azu = Member.get("part=?", ["Gt2"])
>>> print azu
<Member 'Azusa : Gt2'>
>>> macaron.cleanup()

Features

Macaron aims to make the use of database easy for small applications.

  • An object-relational mapper (ORM) for SQLite.
  • There are no dependencies except Python Standard Library.
  • Auto-definition of model fields from database tables.
  • Many-To-One relationships are supported.
  • Pre-defined and user-defined validator can be used.
  • Plugin for Bottle which is a micro-sized web framework is included.
  • Module consists of only single file.

Indices and tables