I apologize for using AT rather than your name, Andre.

On Sep 13, 6:42 pm, Robert <rclonin...@gmail.com> wrote:
> Thanks, AT.  Actually this is the article where I learned how to do
> raw SQL in Django. It made life easy for complex queries.
> Unfortunately it does not specify how to dynamically set the database
> for the RawQuerySet.  I am hoping there is an easy way to do it so I
> can avoid a complete rewrite.  The alternative is to figure out how to
> do what I think are complex queries (includes subqueries, group by,
> having, sum commands) using the ORM QuerySet.
>
> On Sep 13, 5:01 pm, Andre Terra <andrete...@gmail.com> wrote:
>
>
>
> > Not exactly what you want, 
> > buthttps://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom...
>
> > Cheers,
> > AT
>
> > On Tue, Sep 13, 2011 at 5:51 PM, Robert <rclonin...@gmail.com> 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 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.-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
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.

Reply via email to