Combining python and sqlite DB into a single, "executeable".

tcumming123 at gmail.com tcumming123 at gmail.com
Tue Oct 6 17:16:40 EDT 2009


Any body got any ideas how to do the following...

I would like to be able to write an app in python that keeps it's persistent
data in a sqlite database file.

So far so good. The problem, is that I need the python app and the sqlite db
file to exist in the same disk file. This way the app to access the data and
the data are in the same file.

If there is a way to do this, I could (for example) have an address book
app, _AND_ the address book all in the same file. I could put the file on a
usb stick and move it to any other computer. Then click on the file and get
my address book, all without installing anything (even temporary files) on
the local computer. I could add new entries into my address book, copy the
"app+db" file to yet another computer... Note that this would _not_ extract
and/or install files into the local computer. Everything would always stay
within the one "app+db" file.

I suspect that one way to do it would be to have a generic boot-up script
that does some magic that will convince sqlite that the database is some
offset into the file. That way the first part of the file would remain
untouched by sqlite so the file could start with the usual, "#!/usr/bin/env
python" stuff. The actual app could be placed in a well known entry in the
db.

Of course the, "app" could not use any loadable modules that are not,
"common" (and/or keep loadable modules in the db somehow) allowing it to be
moved to most machines. BTW., "most machines" doesn't have to include Windoz
machines...

Any ideas?

tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091006/6841e052/attachment.html>


More information about the Python-list mailing list