Hi,

We have a multi-tenant application where each tenant has their own schema
in PostgreSQL. Traditionally they've all been in the same database, but
we're starting to shard tenants across databases as well, and are using
Session.get_bind() to determine the bind for the current user.

All is good so far. However, we want to selectively migrate the database
schema for users as we see fit, which can result in different columns for
the same models.

Is there a way to dynamically set up the table for a particular declarative
model, i.e. based on the bind? The point is that we'd like all code to
still use the same and only model class, and just have conditionals in the
code where appropriate for the differences in columns.


Best,

Anders Steinlein
*Gründer og alkymistleder*
Eliksir AS – MailMojo og QuizWiz
tlf:  21 42 30 30  mob: 926 13 069
web:  e5r.no           mail: [email protected]

[image: MailMojo]
<https://mailmojo.no/?utm_source=email_signature&utm_medium=email&utm_campaign=email_signature>

<https://www.quizwiz.no/?utm_source=email_signature&utm_medium=email&utm_campaign=email_signature>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to