3 ms·
FWIW, csvkit has similar functionality in its csvsql tool: https://csvkit.readthedocs.io/en/latest/scripts/csvsql.html https://csvkit.readthedocs.io/en/latest/
by danso 5y ago
FWIW, csvkit has similar functionality in its csvsql tool:
https://csvkit.readthedocs.io/en/latest/scripts/csvsql.html https://csvkit.readthedocs.io/en/latest/scripts/csvsql.html
csvsql --query \
"select avg(i.sepal_length) from iris as i join irismeta as m on (i.species = m.species)" \
examples/iris.csv examples/irismeta.csv
I believe it creates an in-memory SQLite database of the CSV, then executes the query and produces the CSV result.
edit: Looking through q's docs, I see that it also uses Python and SQLite in-memory databases:
http://harelba.github.io/q/#implementation http://harelba.github.io/q/#implementation
> The current implementation is written in Python using an in-memory database, in order to prevent the need for external dependencies.
I'm confused though that, according to its Limitations[0] section, it doesn't support CTE's or `SELECT * FROM <subquery>`, when both of those things are supported by the SQLite standard?
[0] http://harelba.github.io/q/#limitations http://harelba.github.io/q/#limitations