Embrace SQL is a JavaScript library for composing SQL queries programmatically using a chainable, fluent API. Current stable version is 2.0.1. It focuses on composing dynamic SQL with a simple, intuitive API that leverages tagged template literals. Key differentiators include zero dependencies, support for PostgreSQL style queries, and a lightweight footprint compared to full ORMs. The library is released as a single package with CJS and ESM exports. It is ideal for projects that need to build SQL queries without the overhead of an ORM.
npm install embrace-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: creating parameterized queries and chaining methods.
Always use backticks with the tag: sql`...${value}...`Update to use tagged template syntax: `.where\`condition\``
Use `.where\`cond1 AND cond2\`` instead.
Use `query.text` and `query.values` when passing to a database driver.
Upgrade Node.js to >=14.
Use `sql.raw` for identifiers: sql`SELECT ${sql.raw('col')} FROM table`Never pass user-generated strings to `sql.raw` without validation.
Write: sql`SELECT * FROM users`
Use: import sql from 'embrace-sql'
Run: npm install embrace-sql
No dependency data recorded yet.