A metric library for calculating complexity scores of SQL queries, version 2.0.0, tailored for MySQL but compatible with other SQL dialects. It evaluates queries without requiring database schema knowledge, using a weighting system based on data complexity (computational complexity, row estimates, index usage) and control flow complexity (subqueries, joins, aggregations). Released under ISC license, maintained on GitHub with CI, and updated with minor versions. Differentiators: zero schema dependency, browser/Node/CLI support, customizable weight sets.
npm install sqomplexityNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an instance with two queries and logs their complexity scores.
Wrap single query in an array: new Sqomplexity(['SELECT 1'])
Use import { Sqomplexity } from 'sqomplexity' instead of requireAlways await the score() call: await sqomplexity.score()
Ensure each query is a string inside an array, even for one query.
Provide a valid JSON file path to --weights option in CLI.
Ensure you are using the correct export and call await sqomplexity.score()
Set 'type': 'module' in package.json, or use .mjs extension.
new Sqomplexity(['SELECT 1']) instead of new Sqomplexity('SELECT 1')Validate SQL syntax; ensure proper quoting and no typos.
No dependency data recorded yet.