pudo/dataset — pull request #41 by jonathaneunice (2013-11-15 23:13:15+00:00)
Title: Added option to configure type of rows returned from queries.

I am a big fan of attribute-based access to database rows. `record.name` reads a lot better to me than `record['name']`. So I've extended `dataset` so that while rows are returned as `dict` by default, one can configure other types when desired. The expected use case is alongside attribute-accessible mappings like [stuf](https://pypi.python.org/pypi/stuf).

import dataset
from stuf import stuf

db = dataset.connect('sqlite:///:memory:', row_type=stuf)

table = db['sometable']
table.insert(dict(name='John Doe', age=37))
table.insert(dict(name='Jane Doe', age=34, gender='female'))

john = table.find_one(name='John Doe')
print john.name

In addition to the code, I've added tests for this patch to show it works. If you merge this functionality, I'll be happy to deepen the tests and submit updated documentation as well.