Using a table from database other than 'default'?

21 views
Skip to first unread message

Steve W

unread,
Jan 15, 2013, 12:05:55 PM1/15/13
to django-s...@googlegroups.com
Hi, 

I'm trying to use a table from a database other than 'default.'

I haven't found where to specify that.

Everything else is working except that the lookup is trying to query against the default database and can't find the table:

SQL log:
2013-01-15 08:51:51 PST ERROR:  relation "mytable" does not exist at character 22


If I copy the table into the default database, it does work perfectly, so I assume that the only problem I have is not knowing how to specify the database.

I know of course how to employ the 'using(databasename)' syntax in a regular django view.

I've poked around in the ModelLookup class thinking that may be a good place to look, but I'm not seeing anything that gives me a clue.

Thanks in advance.







Mark Lavin

unread,
Jan 15, 2013, 1:02:07 PM1/15/13
to django-s...@googlegroups.com
You can extend the ModelLookup.get_queryset to attach the using() clause.

-Mark

Middle Fork GIS

unread,
Jan 15, 2013, 3:00:37 PM1/15/13
to django-s...@googlegroups.com
Thanks for your quick response.

I'll give it a try and report back if I get something workable.

Steve
Reply all
Reply to author
Forward
0 new messages