Showing posts with label sqlsoup. Show all posts
Showing posts with label sqlsoup. Show all posts

Tuesday, 22 September 2009

SqlSoup is cool

I've been playing with our internal wiki's database, and with SqlSoup. I've found that SqlSoup did exactly what I wanted it to do; read a database, infer its table layout, create classes that map attributes to those table columns and allow me to manipulate those classes before adding the modifications back.

This code prints out all the rows in the 'People' table:

from sqlalchemy.ext.sqlsoup import SqlSoup
db = SqlSoup("mysql://root@localhost/movements")
people = db.People.all()
people.sort()
import pprint
pprint.pprint(people)

How simple is that! :-)