printing a SQL construct invokes the default dialect which doesn't support Postgresql operators, use compile() for stringification:
from sqlalchemy.dialects import postgresql dialect = postgresql.dialect() print stmt.compile(dialect=dialect) On May 28, 2013, at 10:23 AM, Jon Nelson <jnel...@jamponi.net> wrote: > I'm having difficulty using PostgreSQL's ANY operator (for use with arrays). > I've tried several variations of the syntax provided in the > documentation, but all I ever get is: > > AttributeError: 'SQLCompiler' object has no attribute 'visit_any' > > What am I likely doing wrong? > I've tried (using declarative-derived mappers): > > print sess.query(ObjectA, dialects.postgresql.Any(ObjectA.column1, > ObjectB.column1)) > and > print dialects.postgresql.Any(ObjectA.column1, ObjectB.column1) > and > print ObjectB.column1.any(ObjectA.column1) > > I am declaring ObjectB.column1 as an ARRAY(Integer()) and > ObjectA.column1 is an Integer(). > > > -- > Jon > Software Blacksmith > > -- > 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.