[GNC] XML vs SQL data integrity question

GWB gwb at 2realms.com
Thu May 7 21:28:16 EDT 2020


The idea about the images is a very good one.  Invoices, receipts,
etc., would do fine in digital format.

No question that databases are capable of much greater depth,
granularity and ability to search and change.  However, in defense of
the humble xml text file, I give you this:

cat GnuCash-xml-file.gnucash | grep -B 1 -A 1 date-posted | less

Which shows every date-posted field and date, and one line before and
one line after.

And:

cat GnuCash-xml-file.gnucash | grep -B 6 -A 3 2019-10-13 | less

Which finds all transactions with date 2019-10-13, the guid,
Description, Currency, etc. (B 6 = 6 lines before, A 3 = 3 lines
after).

Not to mention awk and sed, which can do much more complicated things
with the search and replace terms.  But don't try this without a
current backup.  awk and sed can very  easily ruin a file if just one
argument for regrep replace is off by the slightest term.

But if you can get a command line with bash, or something close, and
you saved a copy as xml, you probably can't do that kind of damage
with grep (but of course, someone will prove this wrong).  If you want
to save your search results:

cat GnuCash-xml-file.gnucash | grep -B 6 -A 3 2019-10-13 >
all-transactions-2019-10-13.txt

Will give you a file with all the transactions from that date with
surrounding fields.  You might need to use ">>" instead of ">" with
some shells.

Then you can see them by:

less all-transactions-2019-10-13.txt

Which then lets you scroll up, down, search within results, etc.

Grep, less and a few shell commands are much easier to learn than sql
query language in my opinion.  But no question a database has lots of
advantages over a text file.

Gordon

On Thu, May 7, 2020 at 7:32 PM Jeff <beastmaster126 at hotmail.com> wrote:
>
> On 5/7/2020 11:18 AM, Gregory Gincley wrote:
> > Sounds like you have a couple of issues happening there.
> >
> > I have no experience with Windows, but I've used the postgres backend
> > in linux for many years without issue.
> >
> > I also periodically save to the XML format as a backup.
> >
> > -Greg
> >
> > On Thu, 2020-05-07 at 00:07 -0500, Jeff wrote:
> >> This has probably been discussed here before but; I'm going ask
> >> anyway.
> >> Which do most people find more reliable with GNC, SQL or the default
> >> XML?  And are there any features I would lose other than the
> >> rollback
> >> ability with SQL?
> >>
> >> I'm getting tired of having to track down account and report issues
> >> every time Windoze 10 hiccups.  I use the default XML,
> >> uncompressed.
> >> One set of books has been corrupted several times, I'm assuming when
> >> Windoze just simply kills the GNC program out of the blue.  I have
> >> another set of books for a business that so far, knock on wood,  the
> >> only problem is sometimes various buttons have to be selected
> >> multiple
> >> times to work then all of the windows open in GNC blur while
> >> processing
> >> then go back to normal display.
> >>
> >> My computers are all networked and dual boot Windoze and Ubuntu, so
> >> I
> >> would need SQL on both sides if I switch over.  I'm leaning towards
> >> PostgreSQL (pro's, con's?  Suggestions?).
> >>
> > _______________________________________________
> > 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
> > If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> > -----
> > Please remember to CC this list on all your replies.
> > You can do this by using Reply-To-List or Reply-All.
> > .
>
> I like Greg's idea of periodically saving back to xml.  Had not thought
> of that.  I do prefer the uncompressed XML format because it is
> basically just one big text file, that makes it easier for me to do
> global search and replace if I have to.  And I'm going to have to, I
> wasn't thinking and moved some images that I had linked to
> transactions.  I've been toying with the idea of writing a companion
> product for the sole purpose of storing the images, then I don't have to
> worry about file names or locations, just switching windows.
>
> I want to say the data issue popped up in GNC 2.6(?) and happened again
> last week in version 3.8.  With every new release of GNC I do a complete
> uninstall of the old version before I upgrade to the next version of
> GNC. Windoze 10 is current on both machines.  And to my knowledge GNC is
> the only program I've had this problem with.  It could possibly be a
> windoze/virus software issue but I would expect it on both machines.
>
> I think I will give SQL a try and see how I like it.  I've always been
> more comfortable using databases than text files for indexed data
> storage anyway.
>
> --
> --JEffrey Black M.B.A.
>
> _______________________________________________
> 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
> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> 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