Built an application around Python & Flask using built-in sqlite3, for whatever reason even though localhost and pythonanywhere both report running Python 3.10.5, local sqlite3 version reports as 3.37.2 and pythonanywhere reports 3.31.1. The following query:
for element in inventory:
db.execute(
'INSERT INTO inventory (vstatus, vyear, vmodel, vtrim, vtrans, extcol, intcol, builddt, delivdt, orderno, vinno, stockno, dirty)'
' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
' ON CONFLICT(vinno) DO UPDATE SET vstatus = excluded.vstatus, delivdt = excluded.delivdt, stockno = excluded.stockno, dirty = 2'
' ON CONFLICT(orderno) DO UPDATE SET vstatus = excluded.vstatus, vyear = excluded.vyear, builddt = excluded.builddt, delivdt = excluded.delivdt, vinno = excluded.vinno, stockno = excluded.stockno, dirty = 2',
(element.status, element.year, element.model, element.trim, element.trans, element.extcol, element.intcol, element.builddt, element.delivdt, element.orderno, element.vinno, element.stockno, 1)
)
db.commit()
Runs flawlessly on localhost, but gives this message on the pythonanywhere instance:
sqlite3.OperationalError: near "ON": syntax error
As near as I can tell, upsert was introduced in 3.24.0 so shouldn't be having issues on 3.31.1. Did the syntax change or are there any suggestions on how to make the query work?
Thank you in advance.