On Sat, Dec 12, 2009 at 7:24 AM, dundeemt <dunde...@gmail.com> wrote:

> I need to access data in other databases.  I don't want them listed in
> model.py as I won't be using django's orm for them. Given this, where
> is the preferred place to put the db connection for this data?  The
> only references I could find show creating a db connection in the
> view, http://www.djangobook.com/en/beta/chapter05/  -- while valid for
> my purposes, is there a better place to cache the connection?
>
> Also, I will be accessing 7+ other databases of varying types, some
> have hundreds of tables and I have no desire to create a model when
> for them when I only need to get to a few values.  I will not be
> updating data in these other databases, only doing lookups.  So I am
> not interested in making a proper django data connection to them.


I think that good design practice would be to create a data access module
for this purpose and import it when you need it.  I've done this a few times
for MySQL access and even wrapped some of the more frequent patterns and
queries into methods in that module.

Nick

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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