richard reitmeyer wrote:
> Hello, all.
>
> I'm trying to use compound fields with in_ to achieve something like
> this:
>
> update foo set svrid = NULL, asof=NULL
>     where (svrid,asof)
>               in (select svrid, asof from foo except select svrid,
> asof from bar);
>
> Use case is cleaning up entries in foo records that refer to damaged
> or missing bar records, where the check is against a column pair. I'm
> expecting ~99% of the records in foo to have a correspondence to
> something in bar.
>
> My problem is in the where clause for the update; I need to apply
> _in(inner_stmt) to something column-like, and I'm missing what that
> would be.  I've tried
> sqlalchemy.sql.expression.ColumnCollection(foo.c.svrid,
> foo.c.asof).in_(inner_stmt) and clearly ColumnCollection has a limited
> set of supported operations.

we have an 0.6 construct called tuple() that allows this.

http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=tuple#sqlalchemy.sql.expression.tuple_



>
> Suggestions?
>
> Richard
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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