Skip to content

sqlite-utils query --functions mechanism for registering extra functions #471

Description

@simonw

It would be really cool if you could register additional custom SQL functions for use with the sqlite-utils query command - something like this:

sqlite-utils data.db 'update images set domain = extract_domain(url)' --functions '
from urllib.parse import urlparse

def extract_domain(url):
    return urlparse(url).netloc
'

Every function defined in that code block would be registered with the connection, unless the name began with an underscore.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions