my first instinct is to have different engines for each schema, since the model of "a different engine per execution thread/request" is very common..the DynamicMetaData object accomplishes this. this might be the quickest way to do it, but that creates a connection pool for each schema; im gathering that youd like the same pool of connections to handle access across all (hypothetical) 100 schemas.
the next level that it may be possible is to have 100 different Table instances for a particular database table, each with a different schema attribute. but this is unwieldy, as if you are using the ORM youd have to make individual mappers for each schema. Assuming that your application requires no communication between these schemas, and for a particular application request you can completely isolate the interaction to just one schema at all times, the Table is probably not where you'd want to differentiate. so it then becomes an application that looks pretty normal, theres an engine, and a set of Tables that correspond to a single schema. just on a per-request basis, you have to make this "customer" selection. so i think your initial suggestion is probably the best. you would probably want to create a session that binds to a specific Connection object, and on that connection you select the desired schema before constructing a session with it. if you want to use the SessionContext for thread local behavior, its main argument is a callable that creates a session, so this callable should probably perform the connection access/schema selection/session construction. and obviously you want to get a close() step in there that insures the connection is returned to the connection pool (using connection.close()). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---