-
-
Notifications
You must be signed in to change notification settings - Fork 351
Open
Labels
Description
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')
.
Xepe, AuHau and b-ggs