Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9183947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:55:36+00:00 2026-06-17T18:55:36+00:00

The documentation for sqlalchemy says that you can specify FOR UPDATE NOWAIT in PostgreSQL

  • 0

The documentation for sqlalchemy says that you can specify “FOR UPDATE NOWAIT” in PostgreSQL 8.1 upwards using Query.with_lockmode(‘update_nowait’). Does anyone know how to get it to add the FOR UPDATE NOWAIT instead of just FOR UPDATE?

PostgreSQL 9.1.6

query = db.session.query(MyTable)\
    .filter_by(process_status="PENDING")\
    .order_by(MyTable.id)\
    .with_lockmode('update_nowait')\

print query

sql:

SELECT 
MyTable.id AS MyTable_id
,MyTable.created_on AS MyTable_created_on
FROM MyTable 
WHERE MyTable.process_status = :process_status_1 
ORDER BY MyTable.id 
FOR UPDATE
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:55:37+00:00Added an answer on June 17, 2026 at 6:55 pm

    I was able to reproduce similar case with Oracle 11g and SQLAlchemy 0.8.0b2.

    db = create_engine('...',echo=True)
    ...
    q = session.query(CauseCode.__table__).with_lockmode('update_nowait')
    print q
    >>>SELECT ... FROM cause_code FOR UPDATE
    print renderquery(q)
    >>>SELECT ... FROM cause_code FOR UPDATE NOWAIT
    q.all()
    >>>2013-01-23 09:58:12,665 INFO sqlalchemy.engine.base.Engine SELECT ... FROM cause_code FOR UPDATE NOWAIT
    

    Usually default query renderer used by str() produce query different from the actual query executed to DB.
    I suspect that sqlalchemy behave in the same way for Postgres in your case – print q produce dialect agnostic query.

    PS renderquery() method implementation can be found here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Documentation for logging module says that If you are implementing asynchronous signal handlers using
Documentation for data.xml/parse says The data is returned as defrecords and can be manipulated
Documentation states that You must use /EHa when using _set_se_translator.. My question is: should
I'm creating a schema for my DB using PostgreSQL and SQLAlchemy in declarative base
Documentation says that waypoints limit is 8 points. But I have to draw a
I need help creating SqlAlchemy query. I'm doing a Flask project where I'm using
Doctrine documentation says you can use public function construct() { ... } as a
I'm using SQLAlchemy 0.6.3 with PostgreSQL 8.4 on Debian squeeze. I want a table
Documentation says that waypoints limit is 8 points. But I have to calculate a
Documentation can be found here It says in the example: onDrop: Called whenever a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.