datasette-explain by simonw

星标

README 源代码

datasette-explain

PyPI Changelog Tests License

解释使用 Datasette 执行的 SQL 查询

安装

在与 Datasette 相同的环境中安装此插件。

datasette install datasette-explain

使用方法

该插件会在查询编辑器页面添加 JavaScript,通过对输入的 SQL 运行 EXPLAIN QUERY PLAN 查询,不断更新页面上的相关信息。

这可能会导致错误消息,或者显示查询计划以及查询使用的所有表。

演示

您可以在 datasette.simonwillison.net 上看到此插件的实际效果。

Demo of this plugin - a SQL query shows the explain plan as well as the three tables that were used in the query (their names and columns)

开发

要在本地设置此插件,请首先检出代码。然后创建一个新的虚拟环境

cd datasette-explain
python3 -m venv venv
source venv/bin/activate

现在安装依赖项和测试依赖项

pip install -e '.[test]'

运行测试

pytest