mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-10-29 06:37:09 +01:00
Replace previously registered convert functions with the same name
This commit is contained in:
parent
9c66bafa52
commit
cab088f765
2 changed files with 23 additions and 1 deletions
|
|
@ -4235,7 +4235,10 @@ class Table(Queryable):
|
|||
fn_name = getattr(fn, "__name__", "fn")
|
||||
if fn_name == "<lambda>":
|
||||
fn_name = f"lambda_{abs(hash(fn))}"
|
||||
self.db.register_function(convert_value, name=fn_name)
|
||||
# replace=True: a previous .convert() may have registered a
|
||||
# different callable under the same name, e.g. two bound methods
|
||||
# called "get" or two functools.partial objects
|
||||
self.db.register_function(convert_value, name=fn_name, replace=True)
|
||||
sql = "update {} set {sets}{where};".format(
|
||||
quote_identifier(self.name),
|
||||
sets=", ".join(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue