This is testing table. Realy not exist in project :) I learning SQLALchemy and try different query :)
Thank for your help :) W dniu sobota, 6 lipca 2013 01:03:54 UTC+2 użytkownik Michael Bayer napisał: > > > On Jul 5, 2013, at 5:18 PM, MacVictor <[email protected] <javascript:>> > wrote: > > > Hi, I try update fields used PostgreSQL, but always i show this errors: > > > > QLAlchemy: (ProgrammingError) operator does not exist: numeric ~~ > unknown > > LINE 1: ... person SET no_card='Test' WHERE person.phone LIKE '%89%... > > ^ > > HINT: No operator matches the given name and argument type(s). You > might need to add explicit type casts. > > 'UPDATE person SET no_card=%(no_card)s WHERE person.phone LIKE > %(phone_1)s' {'no_card': u'Test', 'phone_1': '%89%'} > > > > My query is: > > > session.query(Person).filter(Person.phone.like('%89%')).update({Person.no_card: > > u'Test'}, synchronize_session=False) > > > well the phone number is being stored here as numeric (not a good idea > really, phone numbers aren't really "numbers"). So you'd need to cast: > > from sqlalchemy import cast > > filter(cast(Person.phone, String).like('%89%')) > > > -- 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.
