Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SqLite near field error
#5
(May-24-2018, 02:46 PM)Larz60+ Wrote: Ok, Add the print statement here:
for m,n in zip(newColumnsNames, data):
    sqlstr = "INSERT INTO {tn} {cn} VALUES {vn}".format(tn=tableName, cn=m, vn= n))
    print('sqlstr: {}'.format(sqlstr))
    c.execute(sqlstr)
#    c.execute("INSERT INTO {tn} {cn} VALUES {vn}"\
#        .format(tn=tableName, cn=m, vn= n))

Aha, that's what I got, but I still don't understand what the problem is:

Runtime error (SyntaxErrorException): unexpected token ')'
File "", line 32
sqlstr = "INSERT INTO {tn} {cn} VALUES {vn}".format(tn=tableName, cn=m, vn= n))

^
SyntaxError: unexpected token ')'
Reply


Messages In This Thread
SqLite near field error - by raniat123 - May-24-2018, 02:35 PM
RE: SqLite near field error - by Larz60+ - May-24-2018, 02:42 PM
RE: SqLite near field error - by raniat123 - May-24-2018, 02:42 PM
RE: SqLite near field error - by Larz60+ - May-24-2018, 02:46 PM
RE: SqLite near field error - by raniat123 - May-24-2018, 02:56 PM
RE: SqLite near field error - by Larz60+ - May-24-2018, 03:00 PM
RE: SqLite near field error - by raniat123 - May-24-2018, 05:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help With Python SQLite Error Extra 10 15,533 May-04-2022, 11:42 PM
Last Post: Extra
  Error while transferring data from sqlite to elasticsearch - please help! ps96068 1 2,742 Jun-12-2021, 09:24 AM
Last Post: ibreeden
  UPDATE SQLITE TABLE - Copy a fields content to another field. andrewarles 14 4,573 May-08-2021, 04:58 PM
Last Post: ibreeden
  Bug ? when dataclass field name == field type Cyril 0 1,588 Oct-22-2020, 03:26 AM
Last Post: Cyril
  SQLite Unique constraint failed error djwilson0495 3 13,665 Aug-14-2020, 05:23 PM
Last Post: ndc85430
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,756 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020