-
-
Notifications
You must be signed in to change notification settings - Fork 673
Closed
Labels
Milestone
Description
I'm also going to support a
--python-toolsoption that takes a string of code - similar to how--functionsworks in sqlite-utils: https://sqlite-utils.datasette.io/en/stable/cli.html#defining-custom-sql-functionssqlite-utils query sites.db "select url, domain(url) from urls" --functions ' from urllib.parse import urlparse def domain(url): return urlparse(url).netloc 'Any Python function without a
_prefix will be registered as a tool for that execution of the command.Later on I'll probably add
python_tools:YAML keys to templates.
Originally posted by @simonw in #990
I'll borrow code from https://github.com/simonw/sqlite-utils/blob/094b010fd870e9fe9f020d4df200d4de7f27209b/sqlite_utils/cli.py#L3277