sqlite3 assumed in python example script account_analysis.py ?
Geert Janssens
janssens-geert at telenet.be
Fri Jan 28 10:56:24 EST 2011
On Friday 28 January 2011, Derek Atkins wrote:
> Mark Jenkins <mark at parit.ca> writes:
> >> There is a comment in the script that says it only supports sqlite3
> >> files. The way the session is opened does indeed limit the choice of
> >> input files to sqlite3.
> >>
> >> I'm just wondering, why was this done ?
> >
> > Only to make invoking it on the command line more easy at the time I
> > wrote it.
> >
> >> Simply changing the line that opens
> >> the session from
> >>
> >> gnucash_session = Session("sqlite3://%s" % gnucash_file,
> >> is_new=False)
> >>
> >> to
> >>
> >> gnucash_session = Session(gnucash_file, is_new=False)
> >>
> >> would allow the script to open any kind of database backend.
> >
> > This would require the user to provide the filetype (xml:// or
> > sqlite3://) on the command line as well.
> >
> > I don't have a problem with doing it that way either, it was just
> > laziness when I wrote it.
>
> Um, "file://" should be understood, and "file://" ->
> "xml://","sqlite://" should be runtime-detected for opening existing
> files. I.e. you should be able to run "Session("/path/to/file",
> is_new=False)" and it should auto-detect xml v. sqlite.
>
> To put another way, there /should/ be no requirement that a type be
> applied. The "file" type should be assumed, and the file loader should
> be able to detect xml v. sqlite.
>
> If this is not the case then it is a bug (IMNSHO).
>
> -derek
Indeed. And when I was working on that part of GnuCash I made sure it is
indeed so.
Tested it yesterday with the python sample scripts by the way and can confirm
that all works as intended.
Geert
More information about the gnucash-devel
mailing list