Comment

Ross Reedstrom

As to the posts topic, there is a generic way to take advantage of the native json support in both postgresql and psycopg2: try something like this:

cur.execute('select array_agg(row_to_json(blogcomments)) from blogcomments limit 10')
res=cur.fetchall()
print json.dumps(res[0][0], indent=2)

Aside from the somewhat obscure reasons for the two extra list wrappers, this keeps you columns names/json keys in one place: the db table definition.