[sqlalchemy] Re: Missing "SKIP_LOCKED" from inner subquery of CTE

2019-08-13 Thread Joel Gibson
Yup, converting to a scalar and using the postgres compiler I now see the correct output. The one other thing I had to fix was `column_literal(*)` vs `literal(*)` Thanks for the detailed reply. On Monday, 12 August 2019 18:23:13 UTC-7, Joel Gibson wrote: > > Hi all, > > I've got a queue in postg

[sqlalchemy] Re: Help to translate SQL query into ORM syntax

2019-08-13 Thread kosta
Looks like that my sql statement was not exactly correct.. I've solved my issue, but I'm still not sure that solved one correctly. sq = session.query(db.LessonList.user_id, func.count('*').label('cnt')). group_by(db.LessonList.user_id).subquery() session.query(db.Lesson, sq.c.cnt).filter_by(id=spe