Flask SQLAlchemy显示查询以进行调试 [英] Flask SQLAlchemy display queries for debug
问题描述
我正在使用flask和SQL Alchemy开发一个应用程序. 我需要在每个查询进行调试的时间旁边显示要执行的查询以生成一个页面
I am developing an app with flask and SQL Alchemy. I need to display the queries executed to generate a page alongside the time each query took for debugging
最好的方法是什么?
推荐答案
我自己还没有使用过它,但是似乎Flask Debug工具栏可能对此有所帮助.
I haven't used it myself, but it seems that Flask Debug-toolbar may help with this.
https://github.com/mgood/flask-debugtoolbar
这是django-debug-toolbar的端口,可用于分析查询.
Flask Debug-toolbar的文档没有提到它,但是有SQLAlchemyDebugPanel的代码.
因此,我认为值得一看该项目,看看它是否满足您的需求.
It's a port of the django-debug-toolbar, which can be used for profiling queries.
The documentation of Flask Debug-toolbar doesn't mention it, but there is code for a SQLAlchemyDebugPanel.
So I think it may be well worth to take a look at the project, and see if it does what you need.
这篇关于Flask SQLAlchemy显示查询以进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!