Christian Moe <[email protected]> wrote:

>> Does Org mode provide functionality to work through locally dumped
>> data via simple querying tools like the SQL and/or Datalog?

>> E.g. https://github.com/factbook/cache.factbook.json could be dumped
>> to local disk and queried by issuing statements like "show me all
>> ammunition manufactured after 1950 that is between .30 and .40" and it
>> could just return it nearly instantly.

>> The above hypothetical scenario is based on a HN post
>> (https://news.ycombinator.com/item?id=47114530) and it has some very
>> interesting comments for it.

> SQL is one of the many languages supported by Org mode's literate
> programming functionality, org-babel. This means that in an Org file,
> you can mix descriptive text with executable SQL queries and tables with
> updatable query results. You can also chain together code blocks in
> different languages, e.g. to pass the results of an SQL query to a
> Gnuplot or R code block for plotting, all in the same document. This
> ability to store and process queries along with notes in a structured
> document can be very helpful for exploring a dataset. One still needs to
> write the SQL, though. :)

> […]

I use Org mode for several recurring SQL maintenance tasks,
and it is quite nice for that purpose.

Two major obstacles that one should be aware of: In- and
output of non-texty data.  Passing a variable with a value
containing "'" or querying data that might contain for
example "|" usually leads to "let me M-x sql-postgres RET
real quick". :-(

Tim

Reply via email to