[GNC] Convert xml <-> sqlite on command line
sunfish62 at yahoo.com
sunfish62 at yahoo.com
Mon Oct 7 15:10:29 EDT 2024
I guess I'd just ask what the purpose would be. Why change back and forth?
If you need SQL for some purpose (e.g., to probe your financial data outside of GnuCash) then why not keep the data in SQL all the time?
I generally don't have that need, so I've kept my data in xml, but I've occasionally used SQL queries against the data, so I just saved to SQL as needed. It's really not that much of a burden for occasional purposes.
David T.
On Oct 7, 2024, 1:57 PM, at 1:57 PM, Kevin Buckley via gnucash-user <gnucash-user at gnucash.org> wrote:
>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.
>
>
>_______________________________________________
>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