Write SQL conveniently in Node.js projects by separating SQL statements into external .sql files with ID annotations. Current stable version is 0.1.5. This lightweight library avoids string concatenation and array joins by parsing SQL files and supporting variable substitution using braces and positional parameters. It is suitable for small to medium projects that prefer SQL-in-files over ORMs or template literals. No active development observed since 2016.
npm install friendly-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to load a SQL file, retrieve a statement by ID, perform variable substitution for braces, and enable logging.
Migrate to a maintained SQL template library.
Use brace syntax for substitution. SQLite parameters like $name are left as-is.
Ensure ID in code matches exactly including whitespace.
Run 'npm install friendly-sql' in your project directory.
Use const sql = require('friendly-sql').parse('file.sql');Use absolute path or path.join(__dirname, 'family.sql').