Skip to content

Conversation

mcarpenter
Copy link
Contributor

@mcarpenter mcarpenter commented Feb 9, 2023

Fixes #525. All tests pass.

There's perhaps a better way to name lambdas? There could be a collision if a caller passes a function with name like lambda_123456.

SQLite documentation is a little, ah, lite on function name specs. If there is a character that can be used in place of underscore in a SQLite function name that is not permitted in a Python function identifier then that could be a good way to prevent accidental collisions. (I tried dash, colon, dot, no joy).

Otherwise, there is little chance of this happening and if it should happen the risk is mitigated by now throwing an exception in the case of a (name, arity) collision without replace=True.


📚 Documentation preview 📚: https://sqlite-utils--526.org.readthedocs.build/en/526/

@mcarpenter mcarpenter changed the title Issue 525 Fix repeated calls to Table.convert() Feb 9, 2023
@simonw simonw merged commit 02f5c4d into simonw:main May 8, 2023
simonw added a commit that referenced this pull request May 8, 2023
@@ -409,7 +414,7 @@ def register(fn):
fn_name = name or fn.__name__
arity = len(inspect.signature(fn).parameters)
if not replace and (fn_name, arity) in self._registered_functions:
return fn
raise FunctionAlreadyRegistered(f'Already registered function with name "{fn_name}" and identical arity')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized this represents a backward-incompatible change, so I'm going to back this out of the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repeated calls to Table.convert() fail
2 participants