if it's JSONB then you'd need to CAST it as a CHAR first:
func.lower(cast(column, CHAR)).contains(word.lower()) try it in SQL first at the psql command line to work it out fully. On 01/19/2016 01:30 PM, Sami Pietilä wrote: > I am not exactly sure where to add sql.func.lower(). Following command > gave an error that lower() for jsonb does not exist. > > sql_command = > select([self.tables[subsection].c[id_label]]).where(sql.func.lower(self.tables[subsection].c[column_name]).contains(cast(word.lower(), > JSONB))) > > ProgrammingError: (psycopg2.ProgrammingError) function lower(jsonb) does > not exist > LINE 3: WHERE (lower(baserecords.first_names) LIKE '%' || CAST('"las... > ^ > HINT: No function matches the given name and argument types. You might > need to add explicit type casts. > [SQL: "SELECT baserecords._id \nFROM baserecords \nWHERE > (lower(baserecords.first_names) LIKE '%%' || CAST(%(param_1)s AS JSONB) > || '%%')"] [parameters: {'param_1': '"last"'}] > > > tiistai 19. tammikuuta 2016 18.37.20 UTC+2 Michael Bayer kirjoitti: > > call func.lower(expr) on the expression that you're comparing > towards so > that it will render the SQL LOWER() function, then compare to a lower > case Python value. > > -- > 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 > <mailto:sqlalchemy+unsubscr...@googlegroups.com>. > To post to this group, send email to sqlalchemy@googlegroups.com > <mailto:sqlalchemy@googlegroups.com>. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- 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.