python GnuCash interface to SQL backend

John Ralls jralls at ceridwen.us
Sat Nov 15 12:36:55 EST 2014


> On Nov 15, 2014, at 7:08 AM, Sébastien de Menten <sdementen at gmail.com> wrote:
> 
> Hello John,
> 
> I have put at this address https://github.com/sdementen/piecash/blob/master/docs/source/object_model.rst <https://github.com/sdementen/piecash/blob/master/docs/source/object_model.rst> what I understood from the object model of GnuCash (schema/fields/invariants). 
> I have also added some questions regarding the objects for which you may have the answer... (or these may be somewhere in GnuCash docs I could not find)
> 
> I would be keen to get your opinion on this document. 

Sébastien,

It’s a gross simplification which is wrong in several important respects. The most significant error is the Price table, which is not a central data object, it’s just a record of prices/exchange rates at particular times. Before GnuCash 2.6 it didn’t even contain actual prices booked from transactions. Prices from the price table are used to calculate the default currency value in the Accounts page and on the summary bar, and for some reports. Prices in the register are calculated by the register code at the time of display, and editing the price in the Transfer Dialog changes the value. Another: Transactions *must* balance on value; if a submitted transaction doesn’t balance GnuCash will create a balancing split debited to Imbalance-XXX where XXX is the appropriate currency code for the side of the transaction that’s out of balance. 

While it’s true that the SQL schema for Account doesn’t include a direct book reference, it does have a parent-GUID field which eventually ties it to the root account which, as you noted, is referenced by the book. While the stored state allows only one book per file or database, the importers work by creating a second book in memory, writing the imported records to that book, then merging the second book into the primary one. That would fail if the accounts couldn’t be traced back to the right book.

There’s more, but I’m no more inclined to do a detailed review of and response to your document than I am to review your code.

Regards,
John Ralls




More information about the gnucash-devel mailing list