[issue30952] [Windows] include Math extension in SQlite

Peter Otten report at bugs.python.org
Mon Nov 6 18:27:12 EST 2017


Peter Otten <__peter__ at web.de> added the comment:

A possible workaround is to use create_function():

>>> import sqlite3, math
>>> db = sqlite3.connect(":memory:")
>>> db.execute("select sin(?);", (math.pi,)).fetchone()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
sqlite3.OperationalError: no such function: sin
>>> db.create_function("sin", 1, math.sin)
>>> db.execute("select sin(?);", (math.pi,)).fetchone()
(1.2246467991473532e-16,)

----------
nosy: +peter.otten

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30952>
_______________________________________


More information about the Python-bugs-list mailing list