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 8604049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:28:24+00:00 2026-06-12T02:28:24+00:00

The psycopg docs state: Psycopg connections are not green thread safe and can’t be

  • 0

The psycopg docs state: “Psycopg connections are not green thread safe and can’t be used concurrently by different green threads. Trying to execute more than one command at time using one cursor per thread will result in an error (or a deadlock on versions before 2.4.2).
Therefore, programmers are advised to either avoid sharing connections between coroutines or to use a library-friendly lock to synchronize shared connections, e.g. for pooling.”

I can’t find an implementation of pool that is green thread safe – are there any out there?

  • 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-12T02:28:25+00:00Added an answer on June 12, 2026 at 2:28 am

    I assume you know gevent-psycopg2 module, which makes psycopg greenlet-friendly.

    Looking for connection pooling solution I’ve tried 2 solutions:

    • SQLALchemy – it seems to work properly with monkey-patched threads and gevent-psycopg2. The QueuePool class uses threading module internally for locking, monkey patching is thus necessary, even though gevent-psycopg2 makes psycopg2 green.

    • there’s a psycopg2 connection pooling example in gevent examples

    I’ve tried both solutions, but not at production load – so I can’t say about their robustness yet.

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

Sidebar

Related Questions

When I have a cursor, I know I can safely execute a query as
By refering code at http://initd.org/psycopg/docs/extras.html#dictionary-like-cursor >>> rec['data'] abc'def >>> rec[2] abc'def I was wondering
I am going through Psycopg Connections Pooling documentation, and don't understand what is the
I am working on PostgreSQL and psycopg2. Trying to get feed data which is
I'm trying to install psycopg2 on Python 2.6: easy_install-2.6 psycopg2 but receive lots of
I'm getting an error whilst trying to install psycopg2 on ubuntu 9.10 64 bit.
When specifying a parameter to execute() in psycopg2 in Python, like this: cursor.execute('SELECT *
How can I determine if a table exists using the Psycopg2 Python library? I
Greetings, by using the psycopg2 library of python, I can currently connect to a
I'm trying to call a function from psycopg2 like such: conn = psycopg2.connect(host=name.host.ex, user=username,

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.