Re: [sqlalchemy] How to do scalar sub selects with the ORM correctly?

2017-06-15 Thread 'mike waites' via sqlalchemy
ote: > > > > On 06/15/2017 11:09 AM, 'mike waites' via sqlalchemy wrote: > > Thanks Mike. > > > > I will definitely give this patch a try. I think this is exactly what > > we need. Simon, thanks so much for sharing that post as well, bindparam

Re: [sqlalchemy] How to do scalar sub selects with the ORM correctly?

2017-06-15 Thread 'mike waites' via sqlalchemy
June 2017 14:53:26 UTC+1, Mike Bayer wrote: > > > > On 06/15/2017 08:25 AM, 'mike waites' via sqlalchemy wrote: > > Hi > > > > This is something i've been wrestling in different ways for some time so > > i thought it was time that i sought a definitive answer

[sqlalchemy] Re: How to do scalar sub selects with the ORM correctly?

2017-06-15 Thread 'mike waites' via sqlalchemy
Interestingly I've just discovered the concept of Bundles. http://docs.sqlalchemy.org/en/latest/orm/loading_columns.html#column-bundles Im guessing this could be used to have it populate the model instance with the extra columns ? On Thursday, 15 June 2017 13:25:00 UTC+1, mike waites wrote: >

[sqlalchemy] How to do scalar sub selects with the ORM correctly?

2017-06-15 Thread 'mike waites' via sqlalchemy
Hi This is something i've been wrestling in different ways for some time so i thought it was time that i sought a definitive answer on what the "proper" way to do this is with the ORM. Often you'll want to have some kind of scalar sub select that computes a column in your query. This can be