Best practices for data import

David Grajal dgrabla at gmail.com
Tue May 5 08:59:20 EDT 2015


Hi,

Thanks! Python bindings looks like the best option then.

- Gnucash has an optional plugin for customer data import, but I was not
able to make it work the last time I tried (January this year when I
created a new book).

- I checked the python scripts at gnucash repo. This one
src/optional/python-bindings/example_scripts/new_book_with_opening_balances.py
looks promising but it doesn't deal with customer data.

Has anybody already written a python script for (tabular) customer import?

Best regards,
David



On 05/05/2015 01:09 PM, Geert Janssens wrote:
> 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.
> 
> Regards,
> 
> Geert
> 
> 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 gnucash.org
>> 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