diff options
author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2018-07-08 07:09:20 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2018-07-08 07:09:20 (GMT) |
commit | 0830858aeedecc9ece60349f8c31c2690d1a99f8 (patch) | |
tree | 8cd32ec3cb898edd3631df2378662aa13e8b761a /Doc | |
parent | 8d41278045ee4e8bf1cadb58a7db58d70ad55237 (diff) | |
download | cpython-0830858aeedecc9ece60349f8c31c2690d1a99f8.zip cpython-0830858aeedecc9ece60349f8c31c2690d1a99f8.tar.gz cpython-0830858aeedecc9ece60349f8c31c2690d1a99f8.tar.bz2 |
bpo-34041: Allow creating deterministic functions in Connection.create_function() (GH-8086)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/sqlite3.rst | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index efc74a6..d30e4d4 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -337,17 +337,24 @@ Connection Objects :meth:`~Cursor.executescript` method with the given *sql_script*, and returns the cursor. - .. method:: create_function(name, num_params, func) + .. method:: create_function(name, num_params, func, *, deterministic=False) Creates a user-defined function that you can later use from within SQL statements under the function name *name*. *num_params* is the number of parameters the function accepts (if *num_params* is -1, the function may take any number of arguments), and *func* is a Python callable that is - called as the SQL function. + called as the SQL function. If *deterministic* is true, the created function + is marked as `deterministic <https://sqlite.org/deterministic.html>`_, which + allows SQLite to perform additional optimizations. This flag is supported by + SQLite 3.8.3 or higher, ``sqlite3.NotSupportedError`` will be raised if used + with older versions. The function can return any of the types supported by SQLite: bytes, str, int, float and ``None``. + .. versionchanged:: 3.8 + The *deterministic* parameter was added. + Example: .. literalinclude:: ../includes/sqlite3/md5func.py |