Best practices for data import

Geert Janssens geert.gnucash at
Tue May 5 07:09:38 EDT 2015

Hi David,

Thank you for sharing your experiment.
It illustrates what the gnucash developers have always been loud and 
clear about: don't alter gnucash data outside of the gnucash api !

The database is only a data store. None of the business logic rules are 
stored in there. So if you make modifications outside of gnucash and 
don't take care of *all* data inter-dependencies yourself you are bound 
to run into problems as your experiment illustrated.

Currently the python bindings are probably the best way to manipulate 
gnucash data if you don't want to use the gnucash gui.

Apart from that you can also write an importer against the c-api or 
likely even in guile still although I haven't heard anyone using the 
latter in recent years.

I know there are also external applications/tools that support the 
gnucash datafile format to some extent. Since I haven't tried any of 
those I won't recommend any. I can't tell how complete their support is. 
Use them at your own risk.



On Tuesday 05 May 2015 12:47:43 David Grajal wrote:
> Hi,
> I'm having trouble importing data into Gnucash SQLITE database.
> 1. I used sqlitebrowser to export the customer table from one gnucash
> file and import the data into another
> 2. When I open this new gnucash file with 'externally loaded
> customers' everything seems to work fine. I can edit the customers. I
> can change the customer data. However when I create a NEW customer on
> this file, gnucash try to reuse an ID from one of the loaded
> customers. Also I can POST invoices with these loaded customers, but
> when I try to PAY these already posted invoices Gnucash complains
> because one of the following reasons:
> a. There is no A/C account available (but it works with other
> customers) - Fix if all UUIDs from currencies etc are cleared
> b. Gnucash complains it cannot WRITE on the file
> My guess is that we can READ the sqlite with external tools but we
> need to use gnucash libraries to WRITE into the database because
> there is some kind of data consistency stored somewhere else in the
> database. Gnucash doesnt complain initially about this extra data,
> but eventually there are problems.
> So my question is: How do you write data into the SQlite? Are you
> using the python bindings? Is there a customer-load script? Can I
> import the customers data externally and then inform gnucash somehow
> to recheck the new customer table?
> Best regards,
> David
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at
> -----
> 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