I'm new to Python, so hopefully this isn't too obvious a question. I'm
just wondering if it's possible to use two database servers with
web.py? I've added basic support for odbtpapi to web.py, and I also
have a mysql database.
Say I want to do something like:
a_results = web.select(...select from odbtapi data source...)
for a in a_results:
b_results = web.select(...select from mysql data source...)
...
You'd want something like:
web.ctx.db.select(blah)
web.ctx.db1.select(blah)
Hope this helps,
Ccraig
>
> Well, what you probably need to do is hack in 2 DB instances to ctx
> (the connection object). It gets built for each connection. It
> requires editing web.py itself.
>
> You'd want something like:
> web.ctx.db.select(blah)
> web.ctx.db1.select(blah)
How about this.
import dbhack
db1 = dbhack.db(dbn="mysql", db="", user=...)
db2 = dbhack.db(....)
db1.select(blah)
db2.select(blah)
here is the code. (caution: i havent tested this).
Are you considering adding something like this to web.py?
Thanks again.