4

I am a beginner at python and SQL. I have an upsert clause to my SQL command but my Python SQLite standard library is running on sqlite v3.21 which does not support upsert syntax. The upsert clause only works on SQLite v3.24 and above.

# UPSERT syntax established by PostSQL, Inputs data into SQLite database
c1.executemany("INSERT INTO result(_time,src_ip) VALUES(?,?) ON "
               "CONFLICT(src_ip) DO UPDATE SET Count=Count+1;", to_db)

I tried pip install --upgrade pysqlite,pip install --upgrade sqlite3, and many other commands but it did not update my SQLite Library. It seems Python 3.7.1 does not support SQLite v3.24 and above.

Is there a way to update Python3 SQLite library to v3.24? Is there a way I can download sqlite v3.24+ package to import it to my script?

Thank you!

acb452
  • 63
  • 1
  • 8
  • This isn't a full solution, as it doesn't solve the problem in stock Python, but Anaconda's sqlite package is at 3.26.0 when I updated Python today, meaning I can take advantage of it. Modifying the stock Python likely will take some plumbing. Maybe there's a Conda-forge or similar recipe that can help? – Poik Feb 12 '19 at 21:23
  • Oh! [There's already an answer to this.](https://stackoverflow.com/a/35011654/786020) It's for Python 3.5, but it may be the same for Python 3.6+. – Poik Feb 12 '19 at 21:28

1 Answers1

0

I have the problem..

I replace sqlite3.dll in c:/python3/DLLs