How useful do you find the interactive interpreter?
Andrew Kuchling
akuchlin at mems-exchange.org
Tue Jun 26 09:48:54 EDT 2001
We use the ZODB to store objects, so the interactive prompt becomes a
query environment. Here's an example to change the owner of an
object. ('opendb' is a script that sets up some useful variables and
prints the introductory help message.)
ludwig akuchlin>opendb
database roots available:
template_lib
process_lib
run_db
user_db
business_db
results_db
session_manager
shared_cache
other variables and functions:
database
connection
root
commit() = get_transaction().commit()
abort() = get_transaction().abort()
sync() = connection.sync()
>>> r = run_db.get_run(113)
>>> r.owner
<User at 839e2f8: akuchlin>
>>> r.owner = user_db.get_user('gward')
>>> r.owner
<User at 83a0348: gward>
>>> commit()
It's useful for making changes, or running some ad hoc query over the
database.
--amk
More information about the Python-list
mailing list