Sorry...I found my mistake: .c.sito.like.contains !!! I rewrote the function in this way:
def test_not_like(self): Session = sessionmaker(bind=self.engine, autoflush=True, autocommit=True) session = Session() res = session.query(SITE).filter(SITE.sito.like('Sito%')) return res This return me properly the result I expected but is a LIKE query, but I need a "NOT LIKE" operator as I wrote in the object of this topic. It's possible I didn't understand yours suggestion? mmm...any ideas? Thanks a lot fon any help. Bye Luca On Fri, Sep 27, 2013 at 12:38 PM, pyArchInit ArcheoImagineers < pyarchi...@gmail.com> wrote: > Hi, and thanks for reply. > I try to use it but I make for sure a mistake: > > def test_not_like(self): self.table_name = 'site_table' Session = > sessionmaker(bind=self.engine, autoflush=True, autocommit=True) session = > Session() query = session.query(SITE) table = > Table(self.table_name,self.metadata, autoload=True) res = > query.filter(table.c.sito.like.contains('Excavation') ) return res > > If I run this I receive this error > res = query.filter(table.c.sito.like.contains('Excavation') ) > AttributeError: 'function' object has no attribute 'contains' > > mmm... > > Also I need NOT LIKE and contains seems as LIKE query. > Thanks a lot and best regards > Luca > > > > > > > On Fri, Sep 27, 2013 at 6:11 AM, Ofir Herzas <herz...@gmail.com> wrote: > >> Each column has a 'like' method, so you should be able to filter by it: >> filter(~Table.field.like("%value1%")) >> Hi to all, >> I need to realize a query like this >> >> select * from my_table where field not like "%value1%" and field not >> like "%value2%" >> >> with a sqlalchemy sintax. I looked for around the documentation but it >> seems be impossible. >> Am I wrong? It's possible that the only way could be to use the >> engine.execute method? >> >> Thanks for any suggestion >> >> Best regards >> Luca >> >> -- >> 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 http://groups.google.com/group/sqlalchemy. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "sqlalchemy" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/sqlalchemy/_dpnK-WZzKQ/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> sqlalchemy+unsubscr...@googlegroups.com. >> To post to this group, send email to sqlalchemy@googlegroups.com. >> Visit this group at http://groups.google.com/group/sqlalchemy. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > https://sites.google.com/site/pyarchinit/<http://www.pyarchinit.altervista.org> > pyarchinit - progetto per la gestione integrata dei dati di scavo su > piattaforme GIS Free Open Suorce > -- https://sites.google.com/site/pyarchinit/<http://www.pyarchinit.altervista.org> pyarchinit - progetto per la gestione integrata dei dati di scavo su piattaforme GIS Free Open Suorce -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.