You can control database connections and transactions using transaction management:
http://docs.djangoproject.com/en/dev/topics/db/transactions/ On May 22, 7:41 am, "m...@nysv.org" <markus.tornqv...@gmail.com> wrote: > Hi! > > I'm using python-processing to run things in parallell based > on data in a Django-powered database. > > I'm also seeing all sorts of funky tracebacks: > Traceback (most recent call last): > File "utils/XXXXX.py", line XXXXX, in XXXXXX > XXXXXX = XXXXX(XXXX, XXXXX=XXXXX, XXXX=XXXX) > File "XXXXXX", line XXXXX, in __init__ > self.XXXXX = self.XXXXX[list_index][attr] > File "/var/lib/python-support/python2.5/django/db/models/query.py", > line 238, > in __getitem__ > return list(qs)[0] > File "/var/lib/python-support/python2.5/django/db/models/query.py", > line 162, > in __len__ > self._result_cache.extend(list(self._iter)) > File "/var/lib/python-support/python2.5/django/db/models/query.py", > line 659, > in iterator > for row in self.query.results_iter(): > File "/var/lib/python-support/python2.5/django/db/models/sql/ > query.py", line 2 > 06, in results_iter > for rows in self.execute_sql(MULTI): > File "/var/lib/python-support/python2.5/django/db/models/sql/ > query.py", line 1 > 748, in <lambda> > result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), > ProgrammingError: no results to fetch > > It looks to me like postgres is opening only one connection here. > > What are my options? > > 1. Can I open new connections somehow and force the child-process > functions to use them? > 2. Re-architecture my code totally from a processing.Pool() with .imap > () > to something else? (This is probably what I'll try while I await a > reply :) > 3. Revert to writing my own queries and opening connections really by > hand > 4. Something else? > > Thanks for any reply, I'm sure I'm not the only one fighting this > issue, > though Googling didn't find many others :) > > Oh, and I'd appreciate the ccs in any replies :) > > Thanks! > > -- > mjt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---