Hi all,

Suppose I have a text query like: 

# intentionally arbitrary string

textquery = "SELECT count(*) FROM Address a WHERE a.user_id = :user_id"


And I'm trying to incorporate it into an ORM query on a table User, 
counting the number of Users with an Address, roughly like so:

# wrong!
> session.query(User).filter(sqlalchemy.text(textquery).as_scalar() > 
> 0).count()


But I need to correlate / bindparam / do something to say that the 
":user_id" in textquery should be bound to User.id.

Is this possible?

Thanks!

Chung

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to