beanquery is a customizable and extensible lightweight SQL query tool that works on tabular data, including Beancount__ ledger data.
Beancount
__ https://beancount.github.io/