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

2019-08-12 Thread Mike Bayer
On Mon, Aug 12, 2019, at 9:23 PM, Joel Gibson wrote: > Hi all, > > I've got a queue in postgres that currently uses a raw sql query to dequeue > items. The queue has multiple "topics" that the metadata/selector uses to > dequeue specific items > > DELETE FROM queue > WHERE id = ( > SELECT id

Re: [sqlalchemy] Can't filter on Join?

2019-08-12 Thread Mike Bayer
On Mon, Aug 12, 2019, at 5:49 PM, Michael P. McDonnell wrote: > Hey team - > > I'm trying to figure out how to basically rewrite this: > SELECT > count(task.id) > FROM task > JOIN round on task.game_id = round.game_id > JOIN tournament ON round.tournament_id = tournament.id > WHERE tournament.i

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

2019-08-12 Thread Joel Gibson
Hi all, I've got a queue in postgres that currently uses a raw sql query to dequeue items. The queue has multiple "topics" that the metadata/selector uses to dequeue specific items DELETE FROM queue WHERE id = ( SELECT id FROM queue WHERE :selector = ANY (metadata) ORDER BY queue_date FOR UPDAT

[sqlalchemy] Can't filter on Join?

2019-08-12 Thread Michael P. McDonnell
Hey team - I'm trying to figure out how to basically rewrite this: SELECT count(task.id) FROM task JOIN round on task.game_id = round.game_id JOIN tournament ON round.tournament_id = tournament.id WHERE tournament.id = '626aeaa7-783b-415c-85f9-5222d9c95973'; As this: total_tasks = column_propert

[sqlalchemy] Help to translate SQL query into ORM syntax

2019-08-12 Thread kosta
Hello everyone! I've some trouble to construct right query by ORM, can someone help to construct appropriate subquery. class Lesson(BaseMixin, TimeCreatedMixin, TimeUpdateMixin, Base): users = relationship('User', secondary='lessonlist') title = Column(String(128)) content = Column(Text) order

Re: [sqlalchemy] Postgres array containment query generates FROM-clause that causes failure

2019-08-12 Thread Mike Bayer
the changes set up for the 1.4 series are *extremely* significant, and are intended to push us towards a "SQLAlchemy 2.0" concept that will more clearly embrace the future of Python which includes Py3 only as well as static typing. I am still holding off on completely blogging all of this becaus

Re: [sqlalchemy] Postgres array containment query generates FROM-clause that causes failure

2019-08-12 Thread Elmer de Looff
Hi Mike, I've been playing around with the Postgresql dialect array() type a bit more and have something that appears to work, at least for the small case that I'm trying to solve for myself. I'd like to check whether I'm on the right track with how I'm approaching this though so please find a pat