Importing functions from a database

Bjorn Pettersen BPettersen at NAREX.com
Wed Jan 29 18:58:15 EST 2003


I'd like to be able to semi-transparently load functions from a database
rather than from a file. I.e. given the following code:

  import dbscripts
  dbscripts.myFunction()

I'd like the attribute access to cause a database lookup of the code for
"myFunction" (I'm assuming that dbscripts would replace itself with a
class instance in sys.modules to trap the attribute access etc., etc.).
Extra points for saving the byte code in the db and re-reading the db if
it's been "a while" since the scriptlet was last read (so that I can
update a running system :-)

I was hoping someone had allready done this, but my googling didn't
bring up any obvious candidates... Anyone have any pointers?

-- bjorn





More information about the Python-list mailing list