kitaindia / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

MultiDatabase quoting #260

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The quote_name function in models.py is grabbed from the default database 
connection,  this can cause problems when the default database is not the same 
as the one being used.  Not sure if this is the best way to do this,  but it 
works for me.

from django.db import connections
def qn(*args, **kwargs):
    db_name = router.db_for_read(TaggedItem)
    return connections[db_name].ops.quote_name(*args, **kwargs)

Original issue reported on code.google.com by goclem...@gmail.com on 13 May 2011 at 7:04

GoogleCodeExporter commented 8 years ago
yea,  so what was i thinking,  this solution is absolutely not thread safe, 
etc. 

Original comment by goclem...@gmail.com on 13 May 2011 at 7:24