On Thursday, December 13, 2012 9:56:36 PM UTC+1, Audrius Kažukauskas wrote:
>
>
> In 0.7.9 (using psycopg2 as DBAPI driver) this works: 
>
>   db.session.query(Mark.tags).filter(Mark.tags.op('@>')(['foo'])).all() 
>
> Although in 0.8 it would look nicer: 
>
>   db.session.query(Mark.tags).filter(Mark.tags.contains(['foo'])).all() 
>

Thanks !

In fact i took literally "column_array" and did not transform it to "tags" 
in my example :-P

So it now works, I also had to change the type of tags from :

tags = db.Column(ARRAY(db.String))

to :

tags = db.Column(ARRAY(db.Text))

otherwise I had some issue when querying with character varying[] @> 
text[], it did not match ;-)

Thanks also to Michael for the array() in 0.8 but will wait for the stable 
release.

Have a nice week-end ahead,
Nicolas

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/5nUW4frsV8YJ.
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.

Reply via email to