Re: [sqlalchemy] Need help with update + select query

2016-02-25 Thread sector119
s = select([func.coalesce(func.avg(product_flavor_t.c.size), 0).label('f1'), func.count(product_flavor_t.c.id).label('f2')]).\ select_from(product_t.outerjoin(product_flavor_t)) op.execute(product_t.update().values(servings=s.c.f1, flavors_count=s.c.f2)) I tried that, but it

Re: [sqlalchemy] Need help with update + select query

2016-02-25 Thread Simon King
On Thu, Feb 25, 2016 at 1:19 PM, sector119 wrote: > Hello, > > Can some one help me with that query? I get AttributeError: servings > I expect that sqlalchemy use update from select for that query or it's not > possible and I must use select(...).as_scalar() for every

[sqlalchemy] Need help with update + select query

2016-02-25 Thread sector119
Hello, Can some one help me with that query? I get AttributeError: servings I expect that sqlalchemy use update from select for that query or it's not possible and I must use select(...).as_scalar() for every updated column? s =