Hi all,
what is the proper way to filter for element in a PostgreSQL ARRAY column? in_() does not produce valid syntax for PostgreSQL ( does (value) instead of array[value] ).
For now I'm doing the following, but I'm not sure how to bind values and not have such a gaping sql injection vuln (even though somevalue is checked against a list of allowed (unicode) values, I want proper binding:
rows = session.query(Model).filter(text("{0} @> {1}".format(Model.__table__.c.array_column, 'somevalue').all()
Which should produce: SELECT * FROM model_table WHERE array_column @> ARRAY['somevalue'] -- .oO V Oo. Work Hard, Increase Production, Prevent Accidents, and Be Happy! ;) -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.