[GNC] Using AI for Arbitrary Queries
Wm Tarr
wm at ilipsis.net
Wed Nov 4 05:59:44 EST 2026
I'm glad you found SQL, it is certainly more productive than python for
querying your data. Although I tend to write SQL by hand the LLMs seem
to have a very good understanding of GnuCash's data relationships which
you can see here if you ever get curious
Gnucash_erd.png (2105×2736)
<https://wiki.gnucash.org/wiki/images/8/86/Gnucash_erd.png>
Something like gnucash-mcp (see prev msg) takes the AI a lot further,
you can just type in "what are my 5 biggest assets" and get an answer.
Very simple to install even on Windows if you take the suggested Claude
desktop / .mpcb route.
Wm
On 2026-11-03 22:17, Paul Kroitor wrote:
> If there's any general interest, and after a trying a few approaches,
> here's my current best / easiest way of doing ad hoc analyses of
> Gnucash data:
>
> 1. Save file as SQLite
>
> 2. Connect to the file from a Database Studio app (my favourite is
> DBeaver community edition)
>
> 3. Ask Google Gemini for an appropriate SQL query (eg: "write a sql
> query for dbeaver to report the five largest asset accounts in a
> gnucash sqlite file")
>
> 4. Use SQL Editor > New SQL Script and paste the output from 3 above
>
> 5. Run the query
>
> I choose this approach because it seems to give the correct results
> the first time, whereas other things I tried need a little cajoling to
> run correctly. No promises though!
>
> Paul
>
>
> On 2026-11-03 1:28 p.m., Paul Kroitor wrote:
>> Thank you, that's very helpful.
>>
>> I was more wondering how close to useful AI now is answering
>> arbitrary questions like this, rather than any specific interest in
>> Piecash or SQLAlchemy. I really only chose Gnucash as the data source
>> for the experiment because I had lots of data handy.
>>
>> In one of Arthur C Clarke's books, I think Imperial Earth, a
>> character casually poses a pentaminos question to a computer
>> terminal, which writes and runs a suitable algorithm in seconds. I
>> wondered how close we now were to this dream (nightmare?).
>>
>> FWIW Gemini also suggested an SQL Query to answer the question, which
>> worked perfectly immediately.
>>
>> I conclude that it's nearly there, but it's still simpler to use
>> tried-and-true (possibly more manual) techniques for many such ad hoc
>> questions.
>>
>> Thanks again, Paul
>>
>>
>> On 2026-11-03 2:35 a.m., Wm Tarr wrote:
>>> There are a number of layers here.
>>>
>>> The warning is from SQLAlchemy which piecash uses, you should ask
>>> the current maintainers of piecash about that rather than here.
>>>
>>> Further, if you want to use AI to interact with a gnucash book why
>>> don't you try something like
>>>
>>> ninetails-io/gnucash-mcp: MCP server enabling AI assistants to read
>>> and write GnuCash accounting data
>>> <https://github.com/ninetails-io/gnucash-mcp>
>>>
>>> where someone else has already done all the hard work, I've been
>>> playing with it myself (on a copy of my main book) and I like it.
>>>
>>> Wm
>>>
>>>
>>>
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-user
mailing list