sqlite3 assumed in python example script account_analysis.py ?
Derek Atkins
warlord at MIT.EDU
Fri Jan 28 09:13:21 EST 2011
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
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-devel
mailing list