Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4391615f35
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (16 sloc) 0.706 kb
layout title
Multiple Databases

Multiple Databases


You want to access multiple databases in a single project.


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:

import web

db1 = web.database(dbn='mysql', db='dbname1', user='foo')
db2 = web.database(dbn='mysql', db='dbname2', user='foo')

print'foo', where='id=1')
print'bar', where='id=5')

insert, update, delete and query methods can also be used in the similar way.

Of course, you can use 'host' and 'port' to specify server address and listen port.

Jump to Line
Something went wrong with that request. Please try again.