dbcli / litecli

CLI for SQLite Databases with auto-completion and syntax highlighting
https://litecli.com
BSD 3-Clause "New" or "Revised" License
2.06k stars 67 forks source link

FR: configuration to import custom python functions #158

Open mjpieters opened 1 year ago

mjpieters commented 1 year ago

LiteCLI is built in Python, and the Python bindings for SQLite make it possible to bind custom functions you can then call from SQL, see the Connection.create_function() documentation.

I'd love to see litecli support defining your own custom functions for use in SQL queries. This could be in the form of compiling the source code for such a function embedded in the config file, or to support importing functions from Python modules (I'd suggest a path:callable syntax, where you use importlib to import path, then get the callable name from the imported module to register as a functoin).

Bonus points if you can also register aggregation, window and collation functions!