Re: [sqlalchemy] No NOWAIT for FOR UPDATE

92 views
Skip to first unread message

Mike Bayer

unread,
Jun 13, 2021, 2:59:47 PM6/13/21
to noreply-spamdigest via sqlalchemy
hi


from sqlalchemy import column
from sqlalchemy import table
from sqlalchemy.dialects import postgresql
from sqlalchemy.future import select

t = table("internal", column("person_id_internal"))

sql = select(
    t.c.person_id_internal
).with_for_update(nowait=True)
print(sql.compile(dialect=postgresql.dialect()))


On Sun, Jun 13, 2021, at 12:23 PM, sector119 wrote:
Hello!

On a PostgreSQL database can't get NOWAIT with FOR UPDATE clause (

sqlalchemy 1.4.18

from sqlalchemy.future import select
from unity.models.unity import Internal

sql = select(
    Internal.person_id_internal
).with_for_update(nowait=True)

str(sql)
Out[12]: 'SELECT unity.internals.person_id_internal \nFROM unity.internals FOR UPDATE'


--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
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 sqlalchemy+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages