Re: [sqlalchemy] Multitenancy, filter selects, updates and deletes in do_orm_execute events

2020-12-28 Thread Mike Bayer
yeah that's great with_loader_criteria is going to be great On Mon, Dec 28, 2020, at 1:18 AM, Frédéric CLEMENT wrote: > Hi Mike, > > In the meantime, I tested like that and it works like a charm : > > if orm_execute_state.is_update: > mapper = orm_execute_state.bind_arguments['mapper'] >

Re: [sqlalchemy] Multitenancy, filter selects, updates and deletes in do_orm_execute events

2020-12-27 Thread Frédéric CLEMENT
Hi Mike, In the meantime, I tested like that and it works like a charm : if orm_execute_state.is_update: mapper = orm_execute_state.bind_arguments['mapper'] scope = mapper.entity.__name__ rights = check_rights(session, infos, role, get_scope(scope)) orm_execute_state.statement =

Re: [sqlalchemy] Multitenancy, filter selects, updates and deletes in do_orm_execute events

2020-12-27 Thread Frédéric CLEMENT
Hi Mike, Many thanks for your reply, giving a try to it as soon as it will be released. Le mercredi 23 décembre 2020 à 16:46:53 UTC+1, Mike Bayer a écrit : > In a little while the git master will have new accessors: > > ORMExecuteState.bind_mapper > ORMExecuteState.all_mappers > > so that you

Re: [sqlalchemy] Multitenancy, filter selects, updates and deletes in do_orm_execute events

2020-12-23 Thread Mike Bayer
In a little while the git master will have new accessors: ORMExecuteState.bind_mapper ORMExecuteState.all_mappers so that you can reliably get at the Mapper objects that are the target of an ORM-enabled select(), update() , or delete() see

Re: [sqlalchemy] Multitenancy, filter selects, updates and deletes in do_orm_execute events

2020-12-23 Thread Mike Bayer
First off I admire your motivation to make that happen, that's all new stuff and note there's a lot of fixes to the with_loader_criteria() thing that are sitting in github master right now that will be in 1.4.0b2. The good news is that update() and delete() both support options as well so feel

[sqlalchemy] Multitenancy, filter selects, updates and deletes in do_orm_execute events

2020-12-23 Thread Frédéric CLEMENT
Hi the list, Version 1.4Beta (hopefully 2.0 very soon) I am writing a multitenant application and I need to filter all requests using subqueries. I succeeded to do it for selects doing something like that : *for desc in orm_execute_state.statement.column_descriptions: t =