PyDocs

Nav

Data Persistence

Connection.create_function

  • Connection.create_function(name, narg, func, /, *, deterministic=False)
Creates a new function.
Changed in 3.8, 3.15
  • 3.8: Added the deterministic parameter.
  • 3.15: The first three parameters are now positional-only.
1 Example
>>> import hashlib
>>> def md5sum(t):
...     return hashlib.md5(t).hexdigest()
>>> con = sqlite3.connect(":memory:")
>>> con.create_function("md5", 1, md5sum)
>>> for row in con.execute("SELECT md5(?)", (b"foo",)):
...     print(row)
('acbd18db4cc2f85cedef654fccc4a4d8',)
>>> con.close()
from the Python docs
See Also
No see-alsos for sqlite3/Connection.create_function
0 Notes
No notes for Connection.create_function