@@ -117,6 +117,24 @@ Module functions and constants
117
117
------------------------------
118
118
119
119
120
+ .. data :: apilevel
121
+
122
+ String constant stating the supported DB-API level. Required by the DB-API.
123
+ Hard-coded to ``"2.0" ``.
124
+
125
+ .. data :: paramstyle
126
+
127
+ String constant stating the type of parameter marker formatting expected by
128
+ the :mod: `sqlite3 ` module. Required by the DB-API. Hard-coded to
129
+ ``"qmark" ``.
130
+
131
+ .. note ::
132
+
133
+ The :mod: `sqlite3 ` module supports both ``qmark `` and ``numeric `` DB-API
134
+ parameter styles, because that is what the underlying SQLite library
135
+ supports. However, the DB-API does not allow multiple values for
136
+ the ``paramstyle `` attribute.
137
+
120
138
.. data :: version
121
139
122
140
The version number of this module, as a string. This is not the version of
@@ -139,6 +157,26 @@ Module functions and constants
139
157
The version number of the run-time SQLite library, as a tuple of integers.
140
158
141
159
160
+ .. data :: threadsafety
161
+
162
+ Integer constant required by the DB-API, stating the level of thread safety
163
+ the :mod: `sqlite3 ` supports. Currently hard-coded to ``1 ``, meaning
164
+ _"Threads may share the module, but not connections."_ However, this may not
165
+ always be true. You can check the underlying SQLite library's compile-time
166
+ threaded mode using the following query::
167
+
168
+ >>> import sqlite3
169
+ >>> con = sqlite3.connect(":memory:")
170
+ >>> con.execute("""
171
+ select * from pragma_compile_options
172
+ where compile_options like 'THREADSAFE=%'
173
+ """).fetchall()
174
+
175
+ Note that the `SQLITE_THREADSAFE levels
176
+ <https://sqlite.org/compile.html#threadsafe> `_ do not match the DB-API 2.0
177
+ ``threadsafety `` levels.
178
+
179
+
142
180
.. data :: PARSE_DECLTYPES
143
181
144
182
This constant is meant to be used with the *detect_types * parameter of the
0 commit comments