sql-ts is a TypeScript-first SQL query builder supporting PostgreSQL, MySQL, Microsoft SQL Server, Oracle, and SQLite dialects. Current stable version is 7.1.0. It generates parameterized queries to prevent SQL injection, supports composite queries, joins, subqueries, and table aliasing. Unlike similar libraries like Knex.js, sql-ts provides strong typing for tables and columns via generics, making it ideal for TypeScript projects that need compile-time safety for SQL queries. Release cadence is irregular. Key differentiator: automatic parameterization and dialect compatibility without SQL generation overhead.
npm install sql-tsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic query building with sql-ts, including table definition, parameterized where clause, and dialect-specific output.
Use import { Sql } from 'sql-ts' instead of require('sql-ts').Replace `sql.create({...})` with `sql.define({...})`.Ensure tables have an 'id' column or use explicit column selection, e.g., `user.select(user.name)`.
Always specify the correct dialect when creating the Sql instance.
Use `new Sql('mariadb')` instead of `new Sql('mysql')`.Replace `sql.create(...)` with `sql.define(...)`.
Install sql-ts with 'npm install sql-ts' and use ESM imports: `import { Sql } from 'sql-ts'`.Ensure the generic type passed to `sql.define<{...}>` matches the 'columns' array exactly.Provide one of: 'postgres', 'mysql', 'mssql', 'sqlite', or 'oracle'.
No dependency data recorded yet.