Permalink
Browse files

edit

  • Loading branch information...
1 parent e9e98fc commit ca1d0bb4c5efbd651b26bbab3b6175d337ffeef5 @anandology anandology committed Aug 26, 2008
Showing with 6 additions and 9 deletions.
  1. +6 −9 cookbook/multidbs.md
View
@@ -14,14 +14,11 @@ webpy 0.3 supports multiple databases by removing the database from a part of th
import web
- mydb1 = web.db.connect(dbn='mysql', db='dbname1', user='foo')
- mydb2 = web.db.connect(dbn='mysql', db='dbname2', user='foo')
-
-All of the former database methods work on these objects, such as:
+ db1 = web.database(dbn='mysql', db='dbname1', user='foo')
+ db2 = web.database(dbn='mysql', db='dbname2', user='foo')
-* select('table_name', where="foo = bar")
-* insert('table_name', foo="bar", baz="asdf")
-* update('table_name', where="id = 10", foo="bar")
-* query('table_name', "SELECT * FROM users JOIN friends WHERE users.id = friends.id")
+ print db1.select('foo', where='id=1')
+ print db2.select('bar', where='id=5')
+
+insert, update, delete and query methods can also be used in the similar way.
-See the database module for more information.

0 comments on commit ca1d0bb

Please sign in to comment.