How to use UPDATE ... FROM in SQLAlchemy?
===

I would like to write this kind of statement in SQLAlchemy / Postgres:

    UPDATE slots
      FROM (SELECT id FROM slots WHERE user IS NULL
    	ORDER BY id LIMIT 1000) AS available
       SET user='joe'
     WHERE id = available.id
     RETURNING *;

Namely, I would like to update a limited number of rows matching specified criteria.

PG