I don't use Flask but this is the reason I don't really like the whole Model.query thing. If you query from your Session, there's no issue. The Session should be determining the nature of the query.
That said, Model.query is going to be ultimately calling session.query() anyway, so I think if you set query_class on the Session itself that would work? I forget how the Model.query thing works. On Mar 6, 2014, at 10:32 AM, [email protected] wrote: > Hai, > > I have a multitenancy flask and sqlalchemy application. Models I have given > an extra column client_id and a custom query_class. This query_class then > automatically filters on the client_id stored in the session. Works like a > charm! > > But now, I want to build a second flask application that uses the same > database session (e.g. same settings and models) for admin purposes. So now I > want to bypass the query_class that have been configured in the model on the > within query definition. Something like; > clients = Clients.bypassquery.all() > > Any ideas? > Thanks > > -- > 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 http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
