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)

This is class Person:

class Person(Base):
    __tablename__ = 'person'
    id = Column('id', Integer, Sequence('person_id_seq'), primary_key=True, 
index=True, unique=True, nullable=False)
    name = Column('name', String(200))
    surname = Column('surname', String(200))
    gender = Column('gender', Boolean, unique=False)
    pesel = Column('pesel', Numeric(11, 0))
    phone = Column('phone', Numeric(9, 0))
    email = Column('email', String(200))
    no_card = Column('no_card', String(100))
    status = Column('status', Integer)

    def __init__(self, name, surname):
        self.name = name
        self.surname = surname

    def __repr__(self):
        return u'%s %s, %s' % (self.name, self.surname, self.pesel)

How to resolve this problem?

-- 
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.


Reply via email to