ANN: PyDAO - Python Hibernate-like Object-Relational Mapper

cieslak.dariusz at gmail.com cieslak.dariusz at gmail.com
Wed Jun 27 21:08:31 CEST 2007


PyDAO is very thin object-relational mapper similar to Hibernate (but
much simpler). It's created to speed-up application development. It's
very simple, but powerful, based on POPO (Plain Old Python Objects).

  http://aplikacja.info/PyDAO.html

Main features:

 - can use any database that has DB-API interface (MySQLdb, psycopg
   tested)
 - can work without database at all (useful for early phases of
   development)
 - speeds up unit testing (dedicated in memory database)

What is not handled:

 - automatic scheme generation
 - separate query language
 - automated handling of associations (replaced by filtering by
   foreign keys)

Here's an example how to use PyDAO:

    class User:
        def __init__(self):
            self.id = None
            self.login = None
            self.password = None

    dao = pydao.InMemoryDao()

    # filling database
    user = User()
    user.login = "user1"
    user.password = "roh8OoPh"
    dao.save(user)

    # filtering based on example
    userSearch = User()
    userSearch.login = "user1"
    userList = dao.list(userSearch)

    # updating
    user.password = "eew8Me8g"
    dao.update(user)

Enjoy!

--
Dariusz Cieslak
http://aplikacja.info - custom software systems




More information about the Python-list mailing list