Bug 515589 - SQLite export via CLI
Summary: SQLite export via CLI
Status: REPORTED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other All
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-06 04:59 UTC by Mark Neugebauer
Modified: 2026-02-10 13:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Neugebauer 2026-02-06 04:59:20 UTC
SUMMARY

Add SQLite export via CLI.

I would like to analyze things via Excel Pivot or Power Query. Therefore, I would prefer to have an SQLite database as a streamlined process. This should be easy to accomplish (AKAIK) via Save As -> SQLite. However, I don't want to switch to SQLite permanently and don't want to mix up .kmy and SQLite unintentionally. How about adding a command line option to export to SQLite? This way I would not have to touch the Gui at all. I am not sure if this is a singular use case. Just make up your mind if this might be a useful option. 

STEPS TO REPRODUCE

n.a.

OBSERVED RESULT

n.a.

EXPECTED RESULT

n.a.

SOFTWARE/OS VERSIONS

n.a.

ADDITIONAL INFORMATION

n.a.
Comment 1 Ralf Habacker 2026-02-09 15:10:09 UTC
KMyMoney supports remote control of the application, allowing, for example, loaded kmy or xml files to be saved in a different format and under a different file name.

When support is enabled, the application can be controlled via qdbusviewer using a graphical user interface or via qdbus on the command line.

This option is enabled when building KMyMoney with the cmake switch -DKMM_DBUS=1, which is enabled by default on Linux.

An example of calling an existing function is:

qdbus | grep kmymoney
org.kde.kmymoney-1415

qdbus org.kde.kmymoney-1415 /KMymoney filename
file:///<path-to-actual-loaded-file>

However, the currently supported functions that can be accessed via DBus  (see https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/org.kde.kmymoney.xml) lack a corresponding “saveToFile” function, which would need to be added.
Comment 2 Mark Neugebauer 2026-02-10 04:48:29 UTC
+1

Only drawback I can come up with is that this would exclude Windows users, correct? And probably those features would be a little harder to discover than just some command line parameters (at least from my personal level of expertise). I would be perfectly happy with this solution.
Comment 3 Ralf Habacker 2026-02-10 09:22:39 UTC
(In reply to Mark Neugebauer from comment #2)
> +1
> 
> Only drawback I can come up with is that this would exclude Windows users,
> correct? 
That depends on where you get the binaries from. The binaries you can get from https://kmymoney.org/snapshots.php include DBus support and qdbus.

> And probably those features would be a little harder to discover

See this example how it would work: 
$ kmymoney -n
$ qdbus  $(qdbus | grep kmymoney) /KMymoney open file:///tmp/input.xml
$ qdbus  $(qdbus | grep kmymoney) /KMymoney saveAs file:///tmp/output.xml
$ qdbus  $(qdbus | grep kmymoney) /KMymoney saveAs sql://user@localhost/tmp/output.sqlite?driver=QSQLCIPHER

> than just some command line parameters (at least from my personal level of expertise). 

The D-Bus interface is already in place and has been tested, but I don't know if the other approach is as straightforward. 

> I would be perfectly happy with this solution.

At this point, I would like to mention a utility program that is currently available with kmymoney installations. It is used to export reports in csv, xml, and html format. If you do not need the entire database, but rather the required data in report form, this could be an alternative.

 LANG=C ../kmymoney-master-build/bin/kmmreport-export  --help
Usage: ../kmymoney-master-build/bin/kmmreport-export [options] url
Export KMyMoney reports

Options:
  -h, --help         Displays help on commandline options.
  --help-all         Displays help including Qt specific options.
  -v, --version      Displays version information.
  --csv              Export in csv format (default)
  --html             Export in HTML format
  --xml              Export in xml format
  --reference        Create reference file from output
  --infotable        Use info table for exporting
  --pivottable       Use pivot table for exporting
  --querytable       Use query table for exporting (default)
  --list             List all custom reports
  --output <output>  Filename for generated output
  --report <report>  Process a specific report

Arguments:
  url                file to open
Comment 4 Ralf Habacker 2026-02-10 09:41:47 UTC
(In reply to Ralf Habacker from comment #3)

> Usage: ../kmymoney-master-build/bin/kmmreport-export [options] url
See this example, which is based on https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/views/reports/core/tests/data/test-423870.xml?ref_type=heads

$ cd <kmymoney-source-dir>
$ kmmreport-export  --report "Transactions by account (Base unconverted)" --xml --querytable ./kmymoney/plugins/views/reports/core/tests/data/test-423870.xml 

You will get the following content 

<?xml version="1.0" encoding="utf-8"?>
 <ListTable name="Transactions by account (Base unconverted)">
  <TableRow ctAccount="Account (GBP)" ctAccountID="A000008" ctBalance="0/1" ctCurrency="GBP" ctID="A" ctInstitution="Bank B (GBP)" ctPostDate="2020-01-01" ctPrice="1/1" ctRank="0" ctSourceLines=" ctPrice:1187 ctValue:1196" ctTopAccount="Account (GBP)" ctValue="" />
  <TableRow csID="S0002" ctAccount="Account (GBP)" ctAccountID="A000008" ctCategory="Umbuchung von Opening Balances (GBP)" ctCategoryType="Umbuchung" ctCommodity="GBP" ctCurrency="GBP" ctEntryDate="2020-08-15" ctID="T000000000000000002" ctInstitution="Bank B (GBP)" ctMemo="" ctMonth="Monat von 2020-04-01" ctNumber="" ctPayee="[Leerer Zahlungsempfänger]" ctPostDate="2020-04-05" ctPrice="1/1" ctRank="1" ctReconcileDate="" ctReconcileFlag="Nicht abgeglichen" ctSourceLines=" ctPrice:805 ctValue:828" ctSplit="" ctTag="[Kein Stichwort]" ctTopAccount="Account (GBP)" ctTopCategory="Opening Balances (GBP)" ctValue="100/1" ctWeek="Woche von 2020-03-30" />
  <TableRow csID="S0002" ctAccount="Account (GBP)" ctAccountID="A000008" ctCategory="Clothes" ctCategoryType="Ausgabe" ctCommodity="GBP" ctCurrency="GBP" ctEntryDate="2020-08-15" ctID="T000000000000000004" ctInstitution="Bank B (GBP)" ctMemo="" ctMonth="Monat von 2020-06-01" ctNumber="" ctPayee="Amazon" ctPostDate="2020-06-27" ctPrice="1/1" ctRank="1" ctReconcileDate="" ctReconcileFlag="Nicht abgeglichen" ctSourceLines=" ctPrice:805 ctValue:828" ctSplit="" ctTag="[Kein Stichwort]" ctTopAccount="Account (GBP)" ctTopCategory="Clothes" ctValue="-50/1" ctWeek="Woche von 2020-06-22" />
  <TableRow ctAccount="Account (GBP)" ctAccountID="A000008" ctBalance="50/1" ctCurrency="GBP" ctID="Z" ctInstitution="Bank B (GBP)" ctPostDate="2020-12-31" ctPrice="1/1" ctRank="3" ctSourceLines=" ctPrice:1187 ctValue:1196 ctPrice:1202" ctTopAccount="Account (GBP)" ctValue="" />
  <TableRow ctAccount="Account (GBP)" ctCurrency="GBP" ctDepth="0" ctRank="4" ctSourceLines=" ctValue:372" ctValue="50/1" />
  <TableRow ctAccount="Account (USD)" ctAccountID="A000001" ctBalance="0/1" ctCurrency="USD" ctID="A" ctInstitution="Bank A (USD)" ctPostDate="2020-01-01" ctPrice="1/1" ctRank="0" ctSourceLines=" ctPrice:1187 ctValue:1196" ctTopAccount="Account (USD)" ctValue="" />
  <TableRow csID="S0002" ctAccount="Account (USD)" ctAccountID="A000001" ctCategory="Umbuchung von Opening Balances" ctCategoryType="Umbuchung" ctCommodity="USD" ctCurrency="USD" ctEntryDate="2020-08-15" ctID="T000000000000000001" ctInstitution="Bank A (USD)" ctMemo="" ctMonth="Monat von 2020-01-01" ctNumber="" ctPayee="[Leerer Zahlungsempfänger]" ctPostDate="2020-01-01" ctPrice="1/1" ctRank="1" ctReconcileDate="" ctReconcileFlag="Nicht abgeglichen" ctSourceLines=" ctPrice:805 ctValue:828" ctSplit="" ctTag="[Kein Stichwort]" ctTopAccount="Account (USD)" ctTopCategory="Opening Balances" ctValue="100/1" ctWeek="Woche von 2019-12-30" />
  <TableRow csID="S0002" ctAccount="Account (USD)" ctAccountID="A000001" ctCategory="Books" ctCategoryType="Ausgabe" ctCommodity="USD" ctCurrency="USD" ctEntryDate="2020-08-15" ctID="T000000000000000003" ctInstitution="Bank A (USD)" ctMemo="" ctMonth="Monat von 2020-06-01" ctNumber="" ctPayee="Amazon" ctPostDate="2020-06-27" ctPrice="1/1" ctRank="1" ctReconcileDate="" ctReconcileFlag="Nicht abgeglichen" ctSourceLines=" ctPrice:805 ctValue:828" ctSplit="" ctTag="[Kein Stichwort]" ctTopAccount="Account (USD)" ctTopCategory="Books" ctValue="-50/1" ctWeek="Woche von 2020-06-22" />
  <TableRow ctAccount="Account (USD)" ctAccountID="A000001" ctBalance="50/1" ctCurrency="USD" ctID="Z" ctInstitution="Bank A (USD)" ctPostDate="2020-12-31" ctPrice="1/1" ctRank="3" ctSourceLines=" ctPrice:1187 ctValue:1196 ctPrice:1202" ctTopAccount="Account (USD)" ctValue="" />
  <TableRow ctAccount="Account (USD)" ctCurrency="USD" ctDepth="0" ctRank="4" ctSourceLines=" ctValue:372" ctValue="50/1" />
  <TableRow ctAccount="" ctCurrency="GBP" ctDepth="" ctRank="4" ctRowsCount="2/1" ctSourceLines=" ctValue:457" ctValue="50/1" />
  <TableRow ctAccount="" ctCurrency="USD" ctDepth="" ctRank="5" ctRowsCount="2/1" ctSourceLines=" ctValue:457" ctValue="50/1" />
 </ListTable>
Comment 5 Mark Neugebauer 2026-02-10 13:16:41 UTC
Thanks for the clarification. I did not know that dbus can be handled on Windows as well.

So far I got everything up and running based on sqlite. I will take a look at the other export options and maybe adjust.