Just like to bump this issue.

Is casting inside an overlap even possible? I've tried all sorts of 
variations of parameters to see what will stick. I either get the "visit_X" 
error or an uncasted query, which then postgresql says the && (overlap) 
operation is not allowed.




On Monday, May 6, 2013 2:04:57 PM UTC-4, Glenn Yonemitsu wrote:
>
> Hi, all.
>
> In Postgresql I have a CMS entry model with a tag column varchar(20)[]. I 
> want to do a query so a row with any of the tags will be returned. I know 
> overlap is the method to use but I can't get the casting done correctly.
>
> Right now I am trying (and a lot of searching revealed similar solutions):
>
> query.filter(ContentEntry.tag.overlap(cast(tags, ARRAY(VARCHAR(20)))))
>
> But I am getting the error: AttributeError: 'SQLCompiler' object has no 
> attribute 'visit_array'. Any variation involving ARRAY() or array() says 
> there is no attribute visit_ARRAY or visit_array.
>
> The following hand crafted SQL works, so for now I'm trying to at least 
> get to this point (and as I understand, overlap will use the && operator):
>
> SELECT content_entry.title, content_entry.tag FROM content_entry WHERE 
> content_entry.tag && cast(array['foo', 'bar'] as varchar(20)[]);
>
> How can I get this casted correctly?
>
> Thanks in advance.
>

-- 
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.


Reply via email to