On Dec 2, 1:30 pm, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > A stupid example to start with: > > >>> lt = literal( "True" ) > >>> Event.select( and_(True, lt)) > > This works fine. But the reason I am using "literal" is because I am > using some advanced postgres features inside a Where clause: > > >>> lt = literal(""""geographical_entity.path <@ ARRAY( SELECT b.path FROM > >>> (virtual_region_has_geo_entity NATURAL JOIN virtual_region) a JOIN > >>> geographical_entity b USING (geographical_entity_id) WHERE > >>> virtual_region_id=1)""") > >>> Event.select( and_(True, lt)) > > This does not work. I get a "ProgrammingError" indicating that the > query is wrong. When I look at the log, and copy/paste the SQL-query > that was generated, and paste that into the postgresql shell itself it > works. > So the generated query works. But it doesn't work through SQLAlchemy. > What am I missing? > > Note: the "<@" operator comes from the ltree module!
Aaah.... I see what's going on..... In the postgres logs, I see that the created statement puts quotes around the literal. Essentially passing it on as a string. Is it not possible to avoid that? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---