Skip to content
This repository
Browse code

edit

  • Loading branch information...
commit d7db15f6f9edacd2fb0246f45ab373109e22cfd6 1 parent b2ca622
irrelative irrelative authored anandology committed

Showing 1 changed file with 22 additions and 0 deletions. Show diff stats Hide diff stats

  1. +22 0 cookbook/multidbs.md
22 cookbook/multidbs.md
Source Rendered
... ... @@ -0,0 +1,22 @@
  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.

0 comments on commit d7db15f

Please sign in to comment.
Something went wrong with that request. Please try again.