Also in the relationship docs, see relationship to non primary mapper, which illustrates how to make ad-hoc relationships to subqueries, though typically relationship to target where deleted=false is just a custom primary join condition, a subquery is probably not needed here.
Sent from my iPhone > On Feb 27, 2014, at 8:25 AM, Simon King <si...@simonking.org.uk> wrote: > > That wiki page also links to: > > https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/GlobalFilter > > which is intended to work with relationships as well, but it seems a > lot more complicated. > > Another option might be to map to a SELECT, rather than directly to a table. > > > http://docs.sqlalchemy.org/en/rel_0_9/orm/mapper_config.html#mapping-a-class-against-arbitrary-selects > > The docs discourage mapping to a select because of the complexity of > the resulting queries, but in your case perhaps those queries are > exactly what is required. > > Hope that helps, > > Simon > > On Thu, Feb 27, 2014 at 1:06 PM, RonnyPfannschmidt > <ronny.pfannschm...@gmail.com> wrote: >> >> im already aware of that, but it doesnt expand to relationships and other >> things >> basically i need it taken into account in a lot more places >> >> >>> On Thursday, February 27, 2014 10:59:21 AM UTC+1, Simon King wrote: >>> >>> On Thu, Feb 27, 2014 at 8:44 AM, RonnyPfannschmidt >>> <ronny.pfa...@gmail.com> wrote: >>>> Hi, >>>> >>>> im working on a project where in many tables data can not be deleted, >>>> but >>>> only marked as deactivated, >>>> Propperly handling selection of active data for normal users and all >>>> data >>>> for admins is turning more and more tendious (in particular wrt >>>> relationship >>>> configuration) >>>> >>>> Im wondering if there is a way to configure mappers/queries to >>>> automatically >>>> take such flags into account. >>>> >>>> -- Ronny >>> >>> Perhaps something like this might help: >>> >>> >>> https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/PreFilteredQuery >>> >>> Simon >> >> -- >> 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 sqlalchemy+unsubscr...@googlegroups.com. >> To post to this group, send email to sqlalchemy@googlegroups.com. >> 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 sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.