[GNC] Help with Python interface
Geoff
cleanoutmyshed at gmail.com
Sun Apr 13 22:55:40 EDT 2025
Hi Sam
If you haven't done so already, I suggest you switch your storage format
from XML to SQL - SQLite works very well.
Then have a good read of the PieCash libraries:
https://github.com/sdementen/piecash
Then use that as a basis to roll your own SQL to search etc. It's quite
straightforward once you get your head around the (intriguing) GnuCash
table structures.
I can't help you with the reconciliation logic.
Good luck.
Geoff
=====
On 13/04/2025 9:11 pm, Sam Bull wrote:
> I'm trying to figure out how to use the Python bindings, but the documentation is almost
> non existent. One of the suggestions is to use help() where everything is documented as
> "wrapper method for function", so I don't see how that is useful at all...
> (Also, the docs tell me to contact gnucash-devel for further help, but my email
> was rejected telling me to contact gnucash-user instead...)
>
> I'm trying to import transactions from bank accounts through a custom API. I can create a
> session and find the account I want to import transactions to, and I have some sample code
> that may work to insert new transactions.
>
> I think the things I still need, but can't seem to figure out are:
>
> A way to search for transactions (or splits maybe?) in the account. I see a method to
> search by description, but will probably want to search by a combination of notes, date
> and amount. I could also implement the search myself if I could figure out a way to get
> all (recent) transactions for an account.
> This should allow me to avoid importing transactions that already exist, both
> created by the import previously (maybe storing a unique ID in the notes) or matching
> up to a manually created transaction on date/amount.
> This can probably also allow the script to learn what the other splits should be.
> e.g. By looking at previous transactions to the same entity, it can automatically set
> the new transactions to point to the same account.
>
> It would probably also make sense to be able to reconcile transactions. I'm not clear
> on what APIs/steps would be needed to reconcile fully. e.g. Can I initiate a
> reconciliation using the account balance and ensuring that the new account balance in
> gnucash matches at the end of the reconciliation, all in a script?
>
> Thanks,
> Sam
>
>
> _______________________________________________
> 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