Géry <[email protected]> added the comment:
With Berker Peksag's patch merged in 2016, in the default non auto-commit mode,
sqlite3 implicitly issues a BEGIN statement before any non SELECT statement not
already in a transaction, EXCEPT DDL statements, for backwards compatibility
reasons:
+ /* For backwards compatibility reasons, do not start a transaction if a
+ DDL statement is encountered. If anybody wants transactional DDL,
+ they can issue a BEGIN statement manually. */
+ if (self->connection->begin_statement &&
!sqlite3_stmt_readonly(self->statement->st) && !self->statement->is_ddl) {
+ if (sqlite3_get_autocommit(self->connection->db)) {
+ result = _pysqlite_connection_begin(self->connection);
+ if (!result) {
+ goto error;
+ }
+ Py_DECREF(result);
}
}
Is there any plan to cover DDL statements as well in a future Python version
and deprecate the old behaviour? That would avoid having to insert BEGIN
statements manually for getting transactional DDL statements, like in psycopg2
for PostgreSQL databases.
----------
nosy: +maggyero
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue10740>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com