On Oct 17, 1:29 pm, Carlos Hanson <[EMAIL PROTECTED]> wrote: > On Oct 17, 12:33 am, koenb <[EMAIL PROTECTED]> wrote: > > > In the latest patches for multi-db the QuerySet that is returned is no > > longer fixed, but varies with the model's manager. That should fix > > that problem for now. > > > Koen > > I've installed the latest patches for multi-db agains revision 6453. > It had the same problem. Then I removed the import connection and > replaced it as suggested and got the following: > > Traceback (most recent call last): > File "<console>", line 1, in ? > File "/usr/local/lib64/python2.4/site-packages/django/db/models/ > manager.py", line 65, in all > return self.get_query_set() > File "/usr/local/lib64/python2.4/site-packages/django/db/models/ > manager.py", line 56, in get_query_set > QS = self.db.connection.ops.query_set_class(_QuerySet) > File "/usr/local/lib64/python2.4/site-packages/django/db/backends/ > oracle/base.py", line 96, in query_set_class > connection = self.model._default_manager.db.connection > AttributeError: 'DatabaseOperations' object has no attribute 'model' > > > On 17 okt, 09:03, Ian <[EMAIL PROTECTED]> wrote: > > > > I don't know anything about the multi-db branch, but I imagine that > > > whatever QuerySet does to get the correct connection should work in > > > OracleQuerySet as well. > > > > Note the mere existence of OracleQuerySet will still be problematic in > > > multi-db environments that mix Oracle databases with non-Oracle > > > databases, since OracleQuerySet replaces QuerySet entirely when Oracle > > > is used. However, OracleQuerySet is a hack that will be going away > > > after the QuerySet refactor, which solves both problems in the long > > > run. > > > > Ian > > I will take a look at what QuerySet does to get the connection and see > how it differs from OracleQuerySet. > > Thanks. If you have anything else, I appreciate it. If I happen to > solve the problem, you'll see it here. > > Carlos
I put the following line in the wrong place: connection = self.model._default_manager.db.connection It needs to go in two places in the OracleQuerySet: first, in the iterator() method; second, in the _get_sql_clause() method. The original import made connection a global name, and the reference to self.model is not valid at that point. It must be in the OracleQuerySet methods. Thanks for the help. Carlos --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---