An ES2015 tagged template string library for preparing SQL statements with parameterized queries. Current version 5.2.1 (stable, active). Supports PostgreSQL, MySQL, SQLite, Oracle, and MSSQL via adapters. Provides automatic parameter substitution, nested SQL embedding, join/empty/raw helpers, and bulk insert support. Ships TypeScript types. Differentiates from alternatives by supporting multiple database backends, safe nesting of SQL instances, and zero external dependencies.
npm install sql-template-tagNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage with placeholder substitution, database-specific query properties, nesting, join/empty helpers, and bulk insert.
Use import syntax or upgrade to Node >=14 with "type": "module" in package.json.
Use nested sql calls or join() helper instead of manual string concatenation.
For PostgreSQL use .text; for MySQL/SQLite use .sql; for Oracle use .statement.
Only use raw() with trusted strings; never with user-supplied data.
Define a custom sql function with SupportedValue union type as shown in the documentation.
Add "type": "module" in package.json or use .mjs extension, and ensure Node >=14.
Use import sql from 'sql-template-tag' (ESM) or const sql = require('sql-template-tag').default if using v4 with require.Ensure you are using version >=5.0.0 and imported correctly: import sql from 'sql-template-tag'.
Use import syntax instead of require().
No dependency data recorded yet.