django-cacheops
django-cacheops copied to clipboard
Bug when passing a query to execute that is a psycopg2 SQL object
When you pass a SQL
object from psycopg2.sql
, we run into an unexpected error in the is_sql_dirty
function. When we hit the line that tries to do sql.lower()
, we may have passed in a SQL
object, resulting in packages/cacheops/transaction.py", line 113, in is_sql_dirty sql = sql.lower() AttributeError: 'Composed' object has no attribute 'lower'
Perhaps it would be reasonable to add a block such as
if isinstance(sql.SQL):
sql = sql.as_string(self.connection)
Would love other thoughts on this.
Can you create a test?
The issue still persists.
A test will help to move it.
Hit the same issue while using django-bulk-load.