Wednesday, December 18, 2013

SHOW COLUMNS or Get Column Names From SQLalchemy SELECT Query


Rob Wouter's answer really helped me out:

You can either find the columns by calling result.keys() or you can access them through calling v.keys() inside the for loop.
Here's an example using items():
for v in result:
    for column, value in v.items():
        print('{0}: {1}'.format(column, value))

No comments:

Post a Comment