Re: [sqlalchemy] Re: Dynamic table on the same declarative model

2019-02-03 Thread Mike Bayer
Yeah, sorry have been traveling today, my first answer was overly simplistic because you have the opposite problem of online migrations, instead of one database version accessed by multiple versions of the code, you have multiple database versions you want accessed by one version of code. I think

[sqlalchemy] Re: Dynamic table on the same declarative model

2019-02-03 Thread Sergey V.
We have a similar setup (a PostgreSQL schema per tenant), we deal with different database versions by running different *code versions* - i.e. if you need a new column you release a new code version which knows how to deal with the new column. Switching a tenant to that code version runs an

Re: [sqlalchemy] Dynamic table on the same declarative model

2019-02-03 Thread Anders Steinlein
On Sun, Feb 3, 2019 at 6:00 PM Mike Bayer wrote: > > > On Sun, Feb 3, 2019, 6:18 AM Anders Steinlein >> >> 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

Re: [sqlalchemy] Dynamic table on the same declarative model

2019-02-03 Thread Mike Bayer
On Sun, Feb 3, 2019, 6:18 AM Anders Steinlein 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()

[sqlalchemy] Dynamic table on the same declarative model

2019-02-03 Thread Anders Steinlein
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