Hello, what would be the best way to perform a search against columns of a table ? I have the following code that works fine:
pattern = "%bla%" client_list = self.query.select(or_(model.Client.c.name.like(pattern), model.Client.c.contact.like(pattern), model.Client.c.email.like(pattern))) This generates the following SQL: SELECT clients.name AS clients_name, clients.contact AS clients_contact, clients.email AS clients_email, clients.id_client AS clients_id_client FROM clients WHERE clients.name LIKE %s OR clients.contact LIKE %s OR clients.email LIKE %s ORDER BY clients.name ['%bla%', '%bla%', '%bla%'] Is this the correct way to do it ? Isn't there a way I could give a list of columns to search in rather than doing it like my example ? Or have a short way to search for the given pattern in all columns ? Regards, -- Alexandre CONRAD --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---