diff options
| author | biner <huanghuibin@gmail.com> | 2013-08-01 22:24:31 +0800 |
|---|---|---|
| committer | biner <huanghuibin@gmail.com> | 2013-08-01 22:24:31 +0800 |
| commit | 1a090caaf459eb49f939c0cf385a7b02331b67f3 (patch) | |
| tree | 12caa890338d35ee0b2c9b5f742c746ea95c7607 /doc/build | |
| parent | 25839c064d995b3664f0cef01768961ac5e4807f (diff) | |
| download | sqlalchemy-pr/20.tar.gz | |
mapping multiple tables for one classpr/20
I'm doing something to finish the horizontal shard job.
The examle is sharding to multiple database . And i just do it for
multipls tables in one database.
there is many tables just like msg_00,msg_01..... msg_99
defind the class like Msg() map the tables .
===============================
m = Msg
number = int(uid)%100
tablename = 'msg_%02d'%(number)
m.__uuid__ = uid
m.__table__.name = tablename
===============================
now "m" mapping the table msg_xx .
It works in the select sql.
but fail in the session.add(newmessage) because the sqlalchemy has cache
connection . event one table is Table(msg_00) and another is Table
(msg_01)
So, i edit the memo key . then there is diff insert object .
------------------
It's simple change and useful. It‘s safe for the old version .
sorry for my poor english.
Diffstat (limited to 'doc/build')
0 files changed, 0 insertions, 0 deletions
