manually supply a connection for a model to use. (to take advantage of the ORM in i.e. long running django management command w/ gevent and thousands of greenlets)
Hey guys, I'm looking to manually supply a connection for a model to use. (to take advantage of the ORM in i.e. long running django management command).
Basically I have some loop that is run, and only a portion of the loop requires a connection. I'd like to return the connection back to a pool by having some sort of manual control over the connection the ORM is using. (The connection won't close by itself since this isn't a request/response)
To make things more complex, it's a management command using greenlets each of which can have their own db connection. So what I really want is, for each greenlet, to be able return the connection back to a pool after using django's ORM for some small portion of the greenlet's task.
thanks for any help!
i.e. it would be awesome if there was something like:
my_conn = pool.get()
Player.objects.connection(my_conn).filter(...)
pool.put(my_conn)
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/siZ6GZQXvcIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home