The first tool you should use to analyze whats going on with your database, when developing pyramid apps.
Include project after debug_toolbar.
pyramid.includes =
pyramid_straw.profiler
pyramid_straw.panel
Project consists of two parts
pyramid_straw.only_paths
pyramid_straw.report_hook
pyramid_straw.disable_inspect
If you want to limit what is backtraced for each query
(defaults to package where it is included). You can override
pyramid_straw.only_paths
.
For example:
pyramid_straw.only_paths = ['/home/dz0ny/ebn/src/']
And if you want to send reports somewhere else you can use report hook that needs to be callable and accepts data dict for each query. This would be little expensive in production so beware.
For example:
def report_hook(data):
requests.post(config.my_report_url, json=data)
config.add_settings({
'pyramid_straw.report_hook': report_hook
})
You can also disable query inspection with setting disable_inspect
to false. For example:
config.add_settings({
'pyramid_straw.disable_inspect': False
}) ```