Reputation: 59
I'm not that familiar with Flask/SQLite but I'm trying to insert several items into a DB in one go.
g.db.execute('insert into images(fileName, fileTitle, file_height, file_width, file_size) values (?,?,?,?,?)', filename, request.form['title'], fileMetaData['height'], fileMetaData['width'], fileMetaData['fileSize'])
running that gives me a
TypeError: function takes at most 2 arguments (6 given)
What's the best way go go about doing this? I understand the error but I don't understand how I'm supposed to do it.
Upvotes: 0
Views: 193
Reputation: 3922
I believe the arguments must be a tuple:
g.db.execute('insert into images(fileName, fileTitle, file_height, file_width, file_size) values (?,?,?,?,?)', (filename, request.form['title'], fileMetaData['height'], fileMetaData['width'], fileMetaData['fileSize']))
Upvotes: 2