Re: [sqlalchemy] Patterns for multitenancy

2018-11-20 Thread Mike Bayer
On Mon, Nov 19, 2018 at 5:27 PM Eric Smith wrote: > > Thanks -- the "before_compile" event seems interesting -- that could solve > automatically adding a tenant on the SELECT side of things. note that I've rewritten the PreFilteredQuery and GloblalFilter recipes entirely to use before_compile:

Re: [sqlalchemy] Patterns for multitenancy

2018-11-19 Thread Eric Smith
Thanks -- the "before_compile" event seems interesting -- that could solve automatically adding a tenant on the SELECT side of things. What I wish for is a usage pattern like: 1. When a web request comes in, determine the appropriate tenant 2. Set the tenant somewhere associated with the c

Re: [sqlalchemy] Patterns for multitenancy

2018-11-15 Thread Mike Bayer
On Thu, Nov 15, 2018 at 7:51 PM Eric Smith wrote: > > Are there any good examples/patterns for implementing multitenancy with > SQLAlchemy? > > I'm in the process of converting a single-tenant web application to support > multiple tenants. Using a schema-per-tenant strategy seems appealing -- if

[sqlalchemy] Patterns for multitenancy

2018-11-15 Thread Eric Smith
Are there any good examples/patterns for implementing multitenancy with SQLAlchemy? I'm in the process of converting a single-tenant web application to support multiple tenants. Using a schema-per-tenant strategy seems appealing -- if you can "activate" the schema for a particular tenant on a r