Skip to content

Consider using Django 2.0 execute_wrapper() #214

@shaib

Description

@shaib

Silk currently uses monkeypatching to install its wrapper around SQLCompiler.execute_sql. Django 2.0 provides a new API for installing wrappers around SQL executions, and it may be preferable to use this API when available.

Points arising:

  • The new API works at a lower level, that of the connection rather than SQLCompiler. I'm not sure what the implications are.
  • The new API installs the wrapper only in the current thread and in a context-manager which removes it on exit, these seem to be improvements over the current monkey-patching.
  • There is an intention to make the new API available for older versions of Django, via a 3rd-party package. So, when checking for its availability, the right check is not a Django version check, but rather hasattr(connection, 'execute_wrapper').

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions