Monday, January 30, 2012

Proper way of building model classes in app using 2 databases

Hi,

I'm writting an app which uses 2 databases and I'm wondering how I
should build model classes for tables from second database (which I
only use to read data).

I have a models.py module in my app's package where I defined all the
model classes I needed. I also defined there model classes from second
database but I added "managed = False" meta option to them because I
don't want syncdb to create or reset them. The problem appears when I
do datadump. I got an error telling that a relation "xxx" does not
exists, where "xxx" is relation from second database marked with
"managed = False".

The problem disappears when I create a separate package for model
classes from second database (without adding it to installed apps).
I'd like to ask if solving that problem in such way i the right way?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment