On Thu, Jul 28, 2016 at 4:33 AM, Andrew M <sig...@andrewmackie.com.au> wrote: > Okay, thanks Mike for your comprehensive reply. There is still so much to > learn ... *sigh*. > > Perhaps it's worth including a sentence or two in the docs, helping > overconfident people like myself to understand the benefits / importance of > params (that it's not just .format)? >
If you want to filter your query by a variable column name, you can either use getattr() on a mapped class, or the ".c" dictionary on the underlying table. For example: # If Table is a mapped class colname = 'some_column' column = getattr(Table, colname) session.query(Table).filter(column == value) # If Table is an instance of sqlalchemy.Table colname = 'some_column' column = Table.c[colname] session.query(Table).filter(column == value) Hope that helps, 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.