Repository navigation
Support explicit SQL function deregistration - #906
Open
goingforstudying-ctrl wants to merge 2 commits into
Open
goingforstudying-ctrl wants to merge 2 commits into
goingforstudying-ctrl wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration callbacks can now be deregistered with
Database.register_function(fn, deregister=True), using the API sketched in the owner prototype. The original callable stops being invoked, and its tracked name/arity is cleared so ordinary re-registration works withoutreplace=True.Only registrations tracked by this
Databaseinstance are affected. Unknown or already-cleared signatures are no-ops, preserving built-in SQL functions and callbacks registered directly on the connection. Aliases, SQLite's ASCII case matching, non-ASCII names and distinct arity overloads are covered; cache entries are retained if SQLite rejects the operation. Existing registration defaults and decorator return behavior are preserved, with no new dependencies.Deregistration delegates to
create_function(name, arity, None). Some Python bindings retain aNoneplaceholder that raisesOperationalErrorand can report an unraisableTypeErrorwhen callback tracebacks are enabled. The API documentation states this limitation, and tests capture and validate the expected driver error; the feature does not promise catalog-entry deletion or restoration of an overridden function. The context manager and CLI changes remain outside this patch. Refs #589.Validation on Python 3.11/macOS with network disabled:
sqlite_utilsandtests, and the new RST section: passed.📚 Documentation preview 📚: https://sqlite-utils--906.org.readthedocs.build/en/906/