On Fri, Apr 9, 2010 at 2:34 AM, wizard_2 <wiz...@roborooter.com> wrote:
> Hi everyone,
> Mange dumpdata seems to be ignoring my database router and failing on
> a model thats in a different db.
>
> I have two databases, default (mysql db named knothedashboard) and
> bluecherry (mssql database named dataKNOT). Here's my router. (Should
> I be using dpaste.com?)
>
>    def db_for_read(self, model, **hints):
>        if model._meta.db_table == u'ZZOSHPRH':
>            return 'bluecherry'
>        return None
>
>    def db_for_write(self, model, **hints):
>        if model._meta.db_table == u'ZZOSHPRH':
>            return False
>        return None
>
>    def allow_syncdb(self, db, model):
>        if model._meta.db_table == u'ZZOSHPRH':
>            return False
>        return None
>
>
> I'm not convinced I'm using my router properly. I think I'm OK with
> checking the db_table, but I don't know how to check the model name.
> (I'm new to python and django.) I have allow_syncdb return false for
> the model, and the second db for read and write - but I don't know why
> it wouldn’t be respected during the dump.
>
> I tried using --database to specify only to dump the default db but it
> still tried to dump the offending model.
>
> django.db.utils.DatabaseError: (1146, "Table
> 'knothedashboard.zzoshprh' doesn't exist")
>
> Is this a bug or am I missing something?

This looks like a bug. dumpdata isn't using routing information at all
at present, which looks to me like an oversight on my part from the
introduction of routers.

I've opened ticket #13308 to track the problem; the fix should be
fairly trivial.

http://code.djangoproject.com/ticket/13308

Thanks for the report!

Yours,
Russ Magee %-)

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