Babel functions for the dsq CLI tool by Multiprocess Labs. ❤️
dsq is a command-line tool for running SQL queries against JSON, CSV,
Excel, Parquet, and more.
This package adds Org tables, Org quotes and Org source block results to this list.
If you use MELPA, an easy way to install this package is via
package-install. Alternatively, download ob-dsq.el, put it in your
load-path and require it.
If you use both MELPA and use-package, you can use this, too:
(use-package ob-dsq
:ensure)An SQL query that spans a JSON file and an Org table.
dsq source code blocks use the custom :input header argument (see below)
to specify one or more data sources, then run the SQL query in the
source code block on them. Besides regular files, ob-dsq also supports
Org tables, Org quotes, Org source blocks, etc. as data sources.
The example in the above screenshot shows a dsq source block that runs a
simple SQL query spanning a JSON file named people.json an and Org table
named foods in an Org file name random.org.
ob-dsq uses the custom header arguments described in the list below.
See the examples directory for a lot more features and customization
options provided by Org Babel in general and ob-dsq specifically, such
as specifying the result’s type and formatting, the various options for
passing variables into the query, querying results of an Org source
block, and more!
:input– the list of data sources to query. A data source can be a filename, the name of an Org reference that builds tabular or list data (an Org table, an Org source block, etc.), or an Elisp form that generates any of the above or the data to query directly.:cache– set toyesto enabledsq’s caching feature. Requiresdsqversion 0.15.0 or higher.:convert-numbers– set toyes(default) to enabledsq’s number conversion feature. Requiresdsqversion 0.19.0 or higher.:header– set toyes(default) to include header row in table results.:hlines– set toyesto include horizontal lines between rows in table results.:null-value,:false-value– customize the rendering ofnullandfalsevalues in results.
