Not exactly what you want, but https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly
Cheers, AT On Tue, Sep 13, 2011 at 5:51 PM, Robert <[email protected]> wrote: > > I have inherited the support of a Django application and am new to the > language so I would appreciate some advice. The application requires > getting data from different databases depending on the client. > > The existing code uses the syntax: <model > table>.objects.using(self.CLIENT_DB).get to connect to the correct > databse. > > However, I have some queries that are so complex I have had to use the > rawqueryset with SQL commands such as "for record in <model > table>.objects.raw(<my sql command>) . . .". Apparently "using" is > not an available attribute of the rawqueryset. What is the best way > to dynamically change databases when using a rawqueryset? > > Thanks for your guidance. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > 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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

