AmiDB logo
The power of SQL mixed with the smartness of object-relational mapping


I have used SQLObject and I constantly ran into problems that needed to be hacked away. Then I tried SQLAlchemy, but it was the same limitations. I needed expressiveness badly and control over my queries. Then I thought, I will build something that has the power of SQL and the smartness of object-relational mapping... And that's when I coded AmiDB!




dbinfo = amidb.AmiDBInfo(user='myuser', password='mypwd', db='testdb')
db_pool = amidb.ConnectionPool(dbinfo)

con = db_pool.getConnection()
#print'table', id=5)

Example of use

Here is how queries look like using AmiDB:

Inserting a person into the table person:

amir_id = db.insert("person", name="Amir Salihefendic", age=20)

Selecting a person from the table person:

amir ="person", name="Amir Salihefendic", as_one=True)

Selecting all persons from the table person and printing them out:

all_persons ="person")
for person in all_persons:
  print "%s is %i old" % (, person.age)

Decorating a person with one extra method:

class Person:
  def getName(self):
    return "My name is %s" %
amir ="person", id=amir_id, obj_deco=Person, as_one=True)
print amir.getName()


Change log

  • Version 1.7 - 23. September 2006
    - PostgreSQL support (thanks to Simon Pamies)
    - Bug fixes
    - FreshPool
    - For configuration use AmiDBInfo instead of global scope
  • Version 1.5 - 14. August 2006
    - Moved to using SQLAlchemy as the engine [for maintenance issues].
    - Bug fixes
    - select("person", order_by="name", reversed=True) added
  • Version 1.3 - 1. August 2006
    - No functionality added, but fixed a number of UTF8 issues.
  • Version 1.1 - 20. May 2006
    - A bunch of bug fixes. The most critical is the escape function that made cross site scripting possible. Now MySQLdb.escape is used...
  • Version 1.0 - 3. May 2006
    - Initial release
Powered by Skeletonz