[GNC] Convert xml <-> sqlite on command line
gnucash at 4forl1st5.slmail.me
gnucash at 4forl1st5.slmail.me
Mon Oct 7 06:56:01 EDT 2024
On Sunday, October 6th, 2024 at 23:26, Michael or Penny Novack via gnucash-user <gnucash-user at gnucash.org> wrote:
>
> On 10/5/2024 5:18 PM, Eberhard Beilharz wrote:
>
> > Hi,
> > is there a way to convert a Gnucash file in XML format to SQLite
> > format on the command line and the reverse?
> > I know I can do Save As in the Gnucash UI, but I would like to do it
> > from the command line so that I can automate it.
> > Thanks,
> > Eberhard
I am not aware of any existing tools that do that - in either
direction.
Back in the day, ..., when files were saved, by default, with a
dot-xac extension, it might have been really simple to do it
using GnuCash, from the command line, in that much/most of the
functionality inside the application was coded in Guile/Scheme
and so you could load the "GnuCash library" into, and do some
basic stuff inside, a Guile interpreter, but I'm guessing that
may no longer be an option for you, as there's been a lot of C++
added over the years (and a lot of C "upgraded" to C++) although
one of the Devs might know if enough of the Guile library routines
are still/now in there, and accessible.
Then again, the ability to talk to a "database backend" itself
is "fairly recent", at least in geological time spans, so maybe
there are no Guile mappings for the "export to SQL" capability,
in which case you are looking at something like an XSLT transform
to go in the
xml -> sqlite
direction, and some sqlite parsing tool/library for the other
direction.
The "trick" will be im mimicing GnuCash's internal data structures,
so that you don't lose anything (or maybe even add something!)
across the transformations.
As Michael D Novack suggests though, it should be do-able, given
enough time and effort.
More information about the gnucash-user
mailing list