jazzband / django-silk

Silky smooth profiling for Django
MIT License
4.35k stars 333 forks source link

Calling explain() causes a syntax error #650

Open mapavia opened 1 year ago

mapavia commented 1 year ago
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

stereodamage commented 1 year ago

Possible duplicate of #597