Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

edit

  • Loading branch information...
commit ca1d0bb4c5efbd651b26bbab3b6175d337ffeef5 1 parent e9e98fc
@anandology anandology authored
Showing with 6 additions and 9 deletions.
  1. +6 −9 cookbook/multidbs.md
View
15 cookbook/multidbs.md
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.