django-silk icon indicating copy to clipboard operation
django-silk copied to clipboard

Calling explain() causes a syntax error

Open mapavia opened this issue 1 year ago • 1 comments

ProgrammingError at /admin/user/user/
syntax error at or near "EXPLAIN"
LINE 1: EXPLAIN EXPLAIN SELECT "user"."password", "user"."is_superus...

Can I explicitly add a check on silk/sql.py if not q.startswith("EXPLAIN"):


        # currently we cannot use explain() method
        # for queries other than `select`
        if not q.startswith("EXPLAIN"):
            prefixed_query = f"{prefix} {q}"
            with connection.cursor() as cur:
                cur.execute(prefixed_query, params)
                result = _unpack_explanation(cur.fetchall())
                return '\n'.join(result)
    return None

I cant seem to push my branch and create a PR. I'm new in contributing so I have no clue if I have permissions

mapavia avatar Mar 13 '23 23:03 mapavia

Possible duplicate of #597

stereodamage avatar Apr 23 '23 23:04 stereodamage