Sqlite. How to get value of Auto Increment Primary Key after Insert, other than last_insert_rowid()?

前端 未结 1 1664
北海茫月
北海茫月 2021-02-12 02:35

I am using Sqlite3 with Flask microframework, but this question concerns only the Sqlite side of things..

Here is a snippet of the code:

g.db.execute(\'I         


        
相关标签:
1条回答
  • 2021-02-12 03:19

    The way you're doing it is valid. There won't be a problem if the above snipped is executed concurrently by two scripts. last_insert_rowid() returns the rowid of the latest INSERT statement for the connection that calls it. You can also get the rowid by doing g.db.lastrowid.

    0 讨论(0)
提交回复
热议问题