Registry / database / kburtram-query-plan

kburtram-query-plan

JSON →
library2.6.1jsnpmunverified

A JavaScript library for rendering Microsoft SQL Server execution plans as interactive HTML. Current stable version is 2.6.1, released via npm under the deprecated name 'kburtram-query-plan' (original package 'html-query-plan' is on GitHub). It uses XSLT 1.0 to transform ShowPlanXML into HTML and a JavaScript Canvas-based line drawer. Differentiators: no server-side dependencies, works entirely in the browser, supports both estimated and actual execution plans, includes batch/parallel/warning node overlays. Release cadence is low (last update 2018).

npm install kburtram-query-plan
INSTALL
IMPORT
SIG · KBURTRAM-QUERY-PLA
K
kburtram-query-plan
databasejavascriptv2.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

showPlan
import { showPlan } from 'kburtram-query-plan';
import QP from 'kburtram-query-plan';
The package ships TypeScript types but exports a named function `showPlan`. The global `QP` object is only available via script tag, not ES import.
drawLines
import { drawLines } from 'kburtram-query-plan';
require('kburtram-query-plan').drawLines;
drawLines is used for pre-rendered XSLT output; it's exported as a named function.
QP
const QP = window.QP;
import { QP } from 'kburtram-query-plan';
The global `QP` is not available in ES module builds; use script tags for that API (showPlan, drawLines).

Renders a minimal SQL Server execution plan (Clustered Index Scan) in a div using html-query-plan with CSS and JS files from 'kburtram-query-plan' npm package.

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="node_modules/kburtram-query-plan/dist/qp.css"> <script src="node_modules/kburtram-query-plan/dist/qp.min.js"></script></head> <body> <div id="planContainer"></div> <script> const queryPlanXml = `<?xml version="1.0"?><ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan"> <BatchSequence> <Batch> <Statements> <StmtSimple StatementCompId="1" StatementEstRows="1" StatementSubTreeCost="0.0032831"> <QueryPlan> <RelOp NodeId="0" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="15" EstimatedTotalSubtreeCost="0.0032831" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"> <OutputList> <ColumnReference Database="[AdventureWorks]" Schema="[dbo]" Table="[Test]" Column="Id"/> <ColumnReference Database="[AdventureWorks]" Schema="[dbo]" Table="[Test]" Column="Name"/> </OutputList> <RunTimeInformation> <RunTimeCountersPerThread Thread="0" ActualRows="1" ActualEndOfScans="1" ActualExecutions="1"/> </RunTimeInformation> <IndexScan Ordered="0" ScanDirection="FORWARD"> <DefinedValues> <DefinedValue> <ColumnReference Database="[AdventureWorks]" Schema="[dbo]" Table="[Test]" Column="Id"/> </DefinedValue> <DefinedValue> <ColumnReference Database="[AdventureWorks]" Schema="[dbo]" Table="[Test]" Column="Name"/> </DefinedValue> </DefinedValues> </IndexScan> </RelOp> </QueryPlan> </StmtSimple> </Statements> </Batch> </BatchSequence></ShowPlanXML>`; QP.showPlan(document.getElementById('planContainer'), queryPlanXml); </script></body> </html>
Debug
Known issues
deprecatedPackage name 'kburtram-query-plan' is deprecated; original is 'html-query-plan' on GitHub with no npm version.
fix
Instead of npm, include the library via CDN or download from https://github.com/JustinPealing/html-query-plan/releases.
affects: >=0.0.0
breakingThe npm package 'kburtram-query-plan' exports named functions, not a default object (QP).
fix
For ES modules use: import { showPlan } from 'kburtram-query-plan'; For browser: use script tag and window.QP.
affects: >=1.0.0
gotchaXSLT transformation requires 'qp.xslt' file to be available; not included in npm dist.
fix
Download xslt from GitHub release assets and reference it manually.
affects: >=0.0.0
gotchaPlan XML must be a string with ShowPlanXML root element; namespaces matter.
fix
Ensure XML starts with <ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan">.
affects: >=0.0.0
Errors
Common errors & fixes
Uncaught TypeError: QP.showPlan is not a function
Importing from npm package incorrectly; QP is not a default export.
fix
Use script tag from dist/qp.min.js instead of npm import, or import { showPlan } from 'kburtram-query-plan' and call showPlan() directly.
Cannot find module './qp.xslt'
Trying to use xslt file without including it in bundle or deploying separately.
fix
Copy qp.xslt from GitHub release to your project and ensure it's served alongside the HTML.
The query plan XML is not valid ShowPlanXML format.
XML string passed to showPlan() is missing proper namespace or root element.
fix
Verify XML contains <ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan"> and valid plan content.
Upgrade
Version history
2.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Resources
kburtram-query-plan — npm install kburtram-query-plan · libregistry