With SqlAlchemy, is it possible to build a query which will update only the first matching row?
In my case, I need to update the most recent log entry:
class Log(Base):
    __tablename__ = 'logs'
    id = Column(Integer, primary_key=True)
    #...
    analyzed = Column(Boolean)
session.query(Log)  \
    .order_by(Log.id.desc())  \
    .limit(1)  \
    .update({ 'analyzed': True })
Which results into:
InvalidRequestError: Can't call Query.update() when limit() has been called
It makes sense, since UPDATE ... LIMIT 1 is a MySQL-only feature (with the solution given here)
But how would I do the same with PostgreSQL? Possibly, using the subquery approach?