You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
check_same_thread (bool) – If True (default), ProgrammingError will be raised if the database connection is used by a thread other than the one that created it. If False, the connection may be accessed in multiple threads; write operations may need to be serialized by the user to avoid data corruption. See threadsafety for more information.
and
Serialized: In serialized mode, SQLite can be safely used by multiple threads with no restriction.
... The serialized mode is default on both Mac and Windows so we can probably skip validating that. I did like mentioning the user needs to serialize the writes. They could use one thread for writing only or use locking. So, I just said to serialize.
according sqlite itself said the SQLite library will itself serialize access to database connections and prepared statements so that the application is free to use the same database connection or the same prepared statement in different threads at the same time., why does python sqlite3 need this check_same_thread option? and the sqlite3.threadsafety returned also is 3
the document may statement clear it
The text was updated successfully, but these errors were encountered:
IIUC, you want check_same_thread to be set dynamically? That would be a breaking change; we're not going to do that.
Moreover, if the underlying sqlite3 * database pointer is thread-safe, that does not imply our pysqlite_Connection wrapper is also thread-safe. You may still have to lock in order to prevent races on the connection object itself (the Python object, not the SQLite database pointer).
Documentation
https://docs.python.org/3/library/sqlite3.html#module-functions:
and
#71300:
the code:
cpython/Modules/_sqlite/connection.c
Lines 1698 to 1714 in c141748
the issue:
the
sqlite
originally itself does not have thischeck_same_thread
option, andhttps://sqlite.org/c3ref/c_config_covering_index_scan.html#sqliteconfigserialized:
according
sqlite
itself saidthe SQLite library will itself serialize access to database connections and prepared statements so that the application is free to use the same database connection or the same prepared statement in different threads at the same time.
, why does python sqlite3 need this check_same_thread option? and thesqlite3.threadsafety
returned also is 3the document may statement clear it
The text was updated successfully, but these errors were encountered: