On 03/25/2016 12:23 PM, Jonathan Vanasco wrote:
I created a testcase here
- https://gist.github.com/jvanasco/a2ff04614a23e192ac7f

this has been stumping me this morning.

the sql I want is:

     update table_a set id_b__latest = ( :other_query )

generated from something like:

     s.execute(TableA.__table__
               .update()
               .values(id_b__latest=_q_sub)
               )

other_query is a `session.query(TableB)...limit(1)`

if other_query is a .subquery() , the generated SQL is
"id_b__latest=SELECT" -- which fails because of no parenthesis
if other_query is a .select() or .subquery().select(), then we get an
intermediate query "id_b__latest=(SELECT anon_1.id FROM (SELECT table_b.id"

does anyone know how I can get the parens without the wrapped
intermediate query?

did you try as_scalar() on that subquery? that's usually the best. if it doesn't work I'll go through the test case.












--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to