I have quite a small table, with 5 columns (inlcuding the primary key) and I am trying to export the data into a CSV file
import csv
with DbManager(#MY DATA BASE INFO) as db:
SQLview = 'SELECT * FROM mytable;'
db.cursor.execute(SQLview)
writer = csv.writer(db)
writer.writerow([ i[0] for i in cursor.description ])
writer.writerows(cursor.fetchall())
However I am getting the error
writer = csv.writer(db)
TypeError: argument 1 must have a "write" method
TIA for any help or if you can point me in the right direction :)
csv.writer(db)to do? You want to write to a file, not back to the database.