For some reason, I want to dump a table from a database (sqlite3) in the form of a csv file. I\'m using a python script with elixir (based on sqlalchemy) to modify the datab
with open('dump.csv', 'wb') as f:
out = csv.writer(f)
out.writerow(['id', 'description'])
for item in session.query(Queue).all():
out.writerow([item.id, item.description])
I found this to be useful if you don't mind hand-crafting your column labels.