Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 22 lines (15 sloc) 0.713 kB
d7db15f @irrelative edit
irrelative authored
1 ---
2 layout: default
3 title: Multiple Databases
4 ---
5
6 # Multiple Databases
7
8 webpy 0.3 supports multiple databases by removing the database from a part of the "web" module, and making it a more typical object. For example:
9
10 import web
11
12 mydb1 = web.database(dbn='mysql', db='dbname1', user='foo')
13 mydb2 = web.database(dbn='mysql', db='dbname2', user='foo')
14
15 All of the former database methods work on these objects, such as:
16
17 * select('table_name', where="foo = bar")
18 * insert('table_name', foo="bar", baz="asdf")
19 * update('table_name', where="id = 10", foo="bar")
20 * query('table_name', "SELECT * FROM users JOIN friends WHERE users.id = friends.id")
21
22 See the database module for more information.
Something went wrong with that request. Please try again.