I'm writing a custom sql method to grab some data from schemas outside
of public, but the database library is adding quotes to the schema
names which causes an sql error. Any ideas on a way around this?
def benefits_sql(schema):
from django.db import connection
cursor = connection.cursor()
cursor.execute("select * from %s.benefits", [schema])
benefits = cursor.fetchall()
return benefits
>>> benefits_sql('test)
....
ProgrammingError: syntax error at or near "'test'"
LINE 1: select * from 'test'.benefits
If I hard code in test.benefits it works fine. Thanks in advance for
any help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---