A library for building SQL statements with tagged templates, running database migrations, and bulk executing operations (insert, select, update, delete). Version 2.6.0, actively maintained on GitHub (atheck/db-sql-toolkit). Key differentiators: parameterized SQL via template literals (sql tag), nested SQL composition, sqlLiteral for raw literal insertion, and bulk functions that split operations based on database variable limits. Ships TypeScript definitions. No database driver included – requires user-supplied database adapter with run/query methods.
npm install db-sql-toolkitNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows bulk insert of entities using sql tagged template and bulkInsertEntities with a typed Database interface.
Use the tuple directly with your database adapter (e.g., adapter.run(statement)).
Avoid NOT IN in queries passed to bulkExecuteCommand. Use NOT EXISTS or join instead.
Never pass user input to sqlLiteral. Use parameters via ${} instead.Pass a function that extracts parameters from an entity, as shown in docs.
Stay updated with repository releases.
Ensure your Database object includes MaxVariableNumber (e.g., { run, MaxVariableNumber: 999 }).Use sql`SELECT * FROM table` (with backticks).
Pass a function: (entity: MyType) => unknown[], not an array literal.
No dependency data recorded yet.