Wednesday, March 30, 2011

Joins with multiple databases and temporary tables

I've got a strange situation and I was wondering how to handle it.

The database has stored procedures that crunch on tables and store the
results in temporary tables. These resulting tables point to various
records in persistent tables.

The first question is how to control the connection in Django to leave
the connection open so I don't lose the temporary tables before I'm
finished working with them?

The second part is a bit trickier. The temporary tables are stored in
a different database. I don't want to get into why this was done, but
I need is to override the database name in the models for the
temporary tables. I don't see a way to do this at the model level,
only at the connection level. How do I specify that the model is a
table in a different database? I want to end up with something like

select ... from mytemp.temp1,normal.table1 where;


You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment