Skip to content

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

@simonw

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions