4 ms·
That is cool; Being able to call python code from SQL is very cool. Is it very slow?
by emj 7y ago
That is cool; Being able to call python code from SQL is very cool. Is it very slow?
- kyberias 7y agoBeing able to call python code from SQL is super scary!
- sbierwagen 7y agoWhat attacks do you believe it enables?
- oefrha 7y agoIt simply uses the sqlite3_create_function API, so it’s as fast/slow as your Python function. You can even use Cython if pure Python isn’t fast enough. I use UDFs quite a bit and the performance is fine without extra tweaks most of the time, but for something like pow I’d use the math extension instead which would be way more performant. Btw, user-defined scalar functions aren’t remotely as sexy as user-defined window functions.
- sevensor 7y agoBeware that only recent versions of Python have a sqlite3 recent enough to support window functions. This bit me recently; I had to scrap a prototype, pull all the data out, and use numpy instead. Still, in general, SQLite3 is amazing and it's my automatic first choice when working with 100GiB or less.
- oefrha 7y agoPython links to sqlite3 dynamically so you just need to sub in a more recent sqlite3 (>=3.25.0). I don’t think it has anything to do with the Python version.
- kragen 7y agoI haven't benchmarked it.