Working example of kvp acess in Python

John Ralls jralls at
Thu Jun 12 17:42:58 EDT 2014

On Jun 12, 2014, at 2:17 PM, Christoph Holtermann <c.holtermann at> wrote:
> Even now i find it a bit difficult to get to the kvp layer. I tried to get to the transactions kvps
> ( )
> and ended up writing a function xaccTransGetFrame.
> If i get the frame object I'm happy at the moment. Is it intentional that you put it private and which is
> the intended way to get the kvps of an(y) object ?

Very intentional. Having object state that’s effectively invisible to the object is an incredibly bad design and is largely to blame for the data integrity problems we’ve had with the SQL backend.

On master you can access all of the KVP data using gobject properties. Qof_instance_get() and qof_instance_set() essentially wrap g_object_get and set; in the latter case qof_instance_set also marks the object dirty. Some items also have getter and setter functions; some of those do the change in an edit/commit block, so you might find it a useful optimization to wrap multiple calls in its own edit/commit so that it’s all done at once.

John Ralls

More information about the gnucash-devel mailing list