import sqlite3 as db
conn=db.connect("D:\fncov.db")
conn.create_function("sign", 1, lambda val: val and (val > 0 and 1 or -1))
cur = conn.cursor()
cur.execute("select sign(1), sign(-1), sign(0), sign(-99), sign(99)")

输出

print (cur.fetchall())
[(1, -1, 0, -1, 1)]

import math
conn.create_function("log", 1, lambda val: math.log(val,10))
cur.execute("select log(2)")

输出

print (cur.fetchall())
[(0.30102999566398114,)]