Nested transactions with SQLAlchemy and sqlite

后端 未结 3 1694
悲哀的现实
悲哀的现实 2020-12-11 04:20

I\'m writing an application in Python using SQLAlchemy (and Elixir) with SQLite as the database backend. I start a new transaction using the code session.begin_transac

3条回答
  •  离开以前
    2020-12-11 04:49

    Although sqlite does appear to support nested transactions via SAVEPOINT, it's only as of version 3.6.8, released 2009 Jan 12. Python, at least up to v2.6, uses earlier versions:

    c:\svn\core\apps\general>python
    Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
    >>> import sqlite3 as s
    >>> s.sqlite_version
    '3.5.9'
    

    I believe you can install PySqlite yourself and the latest appears to support v3.6.12. I can't say for sure this will solve your problem though, but I believe the answer explains why it's not working for you now.

提交回复
热议问题