Hello,

In order to use the PostgreSQL LOCK 
<https://www.postgresql.org/docs/14/sql-lock.html> with SQLAlchemy, is 
there a better way than


*session.execute(sa.text(f"LOCK TABLE {Foo.__tablename__} IN SHARE MODE"))*

Poking through the dialect 
<https://docs.sqlalchemy.org/en/20/dialects/postgresql.html> docs or SQLA 
at large, I didn’t find much. This post 
<https://groups.google.com/g/sqlalchemy/c/8WLhbsp2nls> is a little dated, 
and this comment 
<https://groups.google.com/g/sqlalchemy/c/skZ7DRwQJNc/m/EK0EAmGrW-sJ> seems 
to recommend the above approach (using a connection).

Also, do I need to *flush()* to push the LOCK to the db?

Much thanks!
Jens

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/0cfe4a51-f013-4299-a584-9ddb643bc906n%40googlegroups.com.

Reply via email to