diff -r e4383a510089 -r 26f9d2a1a553 doc/book/en/D020-cookbook.txt --- a/doc/book/en/D020-cookbook.txt Thu Apr 23 13:46:57 2009 -0700 +++ b/doc/book/en/D020-cookbook.txt Thu Apr 23 14:05:55 2009 -0700 @@ -62,3 +62,19 @@ cnx.commit() cnx.close() + +* How to load data from a script? + + The following script aims at loading data within a script assuming pyro-nsd is + running and your application is configured with ``pyro-server=yes``, otherwise + you would not be able to use dbapi. :: + + from cubicweb import dbapi + + cnx = dbapi.connection(database='instance-id', user='admin', password='admin') + cur = cnx.cursor() + for name in ('Personal', 'Professional', 'Computers'): + cur.execute('INSERT Blog B: B name %s', name) + cnx.commit() + +