{"id":43998,"library":"squel-ts","title":"squel-ts","description":"squel-ts (v1.1.5) is a TypeScript and ESM fork of the abandoned squel SQL query builder library. It provides a flexible, zero-dependency query string builder for SQL databases, supporting SELECT, INSERT, UPDATE, DELETE, and engine-specific commands (MySQL etc.) via a fluent, chainable API. Released as a maintenance fork, it targets modern Node.js (>=12) and browsers, with built-in TypeScript definitions. Unlike Knex, it generates raw query strings without requiring a connection, making it lightweight for embedding. Release cadence is low; consider it in maintenance mode.","status":"maintenance","version":"1.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/rossreicks/squel-ts","tags":["javascript","sql","database","rdbms","typescript"],"install":[{"cmd":"npm install squel-ts","lang":"bash","label":"npm"},{"cmd":"yarn add squel-ts","lang":"bash","label":"yarn"},{"cmd":"pnpm add squel-ts","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"select is a named export, not default. Common mistake from original squel CJS pattern.","wrong":"import select from 'squel-ts'","symbol":"select","correct":"import { select } from 'squel-ts'"},{"note":"ESM-only module; require() will fail. Use dynamic import() if needed.","wrong":"const squel = require('squel-ts')","symbol":"squel (namespace)","correct":"import * as squel from 'squel-ts'"},{"note":"DELETE query builder is exported as 'remove' (not 'delete') to avoid JS reserved word.","wrong":"import { update, insert, delete } from 'squel-ts'","symbol":"update / insert / remove","correct":"import { update, insert, remove } from 'squel-ts'"},{"note":"Type-only imports are safe but not strictly required since the library ships TypeScript types.","wrong":"","symbol":"QueryBuilder types","correct":"import type { QueryBuilder, SelectQueryBuilder } from 'squel-ts'"}],"quickstart":{"code":"import { select, insert, update, remove } from 'squel-ts';\n\n// SELECT\nconst query = select()\n  .from('users')\n  .field('id', 'userId')\n  .field('name')\n  .where(\"age > ?\", 18)\n  .order('name', true)\n  .limit(10)\n  .toString();\nconsole.log(query);\n// SELECT id AS \"userId\", name FROM users WHERE (age > 18) ORDER BY name ASC LIMIT 10\n\n// Parameterized\nconst param = select()\n  .from('users')\n  .where(\"status = ?\", 'active')\n  .toParam();\nconsole.log(param);\n// { text: 'SELECT * FROM users WHERE (status = ?)', values: ['active'] }","lang":"typescript","description":"Builds a SELECT query with field aliasing, filtering, ordering, and pagination. Shows both raw and parameterized output."},"warnings":[{"fix":"Use ESM imports: import { ... } from 'squel-ts' or dynamic import('squel-ts').","message":"squel-ts is ESM-only and does not support CommonJS require(). Direct require() will throw a MODULE_NOT_FOUND error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Import and use remove({...}) instead of delete({...}).","message":"DELETE queries are built via the exported `remove` function, not `delete`. Using `delete` will cause a ReferenceError in strict mode.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Pass `{ autoQuoteFieldNames: true }` to the query builder constructor, e.g., select({ autoQuoteFieldNames: true }).","message":"Field names are not automatically quoted unless `autoQuoteFieldNames` option is enabled. Without quoting, field names with special characters can produce invalid SQL.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to squel-ts and consult CHANGELOG for breaking changes. The API is largely compatible.","message":"The original squel library is abandoned. squel-ts is a TypeScript fork with API refinements; some edge cases may differ.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Ensure all objects in a bulk insert have the same property order, or use explicit field() calls.","message":"Bulk Insert key order is not guaranteed. When inserting multiple rows, the order of columns in the resulting SQL may vary across objects, causing misalignment.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'12':61 'abandon':16 'api':51 'browser':63 'builder':20,31 'built':66 'built-in':65 'cadenc':87 'chainabl':50 'command':44 'connect':80 'consid':90 'databas':34,97 'definit':69 'delet':39 'depend':28 'embed':85 'engin':42 'engine-specif':41 'esm':12 'etc':46 'flexibl':25 'fluent':49 'fork':13,56 'generat':73 'insert':37 'javascript':95 'knex':71 'librari':21 'lightweight':83 'low':89 'mainten':55,93 'make':81 'mode':94 'modern':59 'mysql':45 'node.js':60 'provid':23 'queri':19,29,75 'raw':74 'rdbms':98 'releas':52,86 'requir':78 'select':36 'specif':43 'sql':18,33,96 'squel':2,5,17 'squel-t':1,4 'string':30,76 'support':35 'target':58 'ts':3,6 'typescript':10,68,99 'unlik':70 'updat':38 'v1.1.5':7 'via':47 'without':77 'zero':27 'zero-depend':26","created_at":"2026-06-05T17:02:28.924276+00:00","updated_at":"2026-06-05T17:02:28.924276+00:00","problems":[{"fix":"Use 'import * as squel from \"squel-ts\"' or 'const squel = await import(\"squel-ts\")'.","cause":"squel-ts is ESM-only; require() is not supported.","error":"const squel = require('squel-ts')"},{"fix":"Use 'import { select } from \"squel-ts\"'.","cause":"Default export does not exist; all builders are named exports.","error":"import select from 'squel-ts' // TypeError: squel_ts_1.default is not a function"},{"fix":"Use 'import { remove } from \"squel-ts\"' or 'squel.remove()'.","cause":"DELETE builder is exported as 'remove' to avoid JS reserved word.","error":"squel.delete() is not a function"},{"fix":"Set 'moduleResolution' to 'node16' or 'bundler' in tsconfig.json, or use '--moduleResolution node16'.","cause":"TypeScript may not resolve ESM modules correctly without 'moduleResolution' set to 'node16' or 'bundler'.","error":"Cannot find module 'squel-ts' or its corresponding type declarations."},{"fix":"Check import: use 'select' from 'squel-ts', not 'Squel' or other internal class.","cause":"Calling select(options) or similar constructor with object argument not allowed? Actually squel-ts does accept options; error may arise if importing wrong symbol.","error":"Expected 0 arguments, but got 1."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/rossreicks/squel-ts#readme","github":"https://github.com/rossreicks/squel-ts","docs":null,"changelog":null,"pypi":null,"npm":"squel-ts","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}