Joseph Wayodi
unread,Nov 4, 2010, 6:31:02 AM11/4/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi people,
I am running some Django code that creates objects in the database. I am using PostgreSQL via psycopg2. However, I am running this code from the Django shell, and not as part of a request. I therefore have to handle a few things manually, for example, closing connections to the database. The code creates multiple threads to do the object creation, and I soon hit the maximum limit of allowed connections to the database.
How can I get hold of the connection used to create the object, from within each thread, so that each thread closes the connection that it has just used? Alternatively, how can I get a list of all the open connections that Django is using at any one time. I am using the "standard" model query API, and not executing custom SQL directly.
Thanks,
Joseph.