{"id":42502,"library":"chill-sql","title":"chill-sql","description":"Type-safe MySQL query builder for TypeScript (v2.0.0). Creates SQL queries with full TypeScript inference from user-defined table schemas, supporting select, insert, update, delete, joins, subqueries, transactions, and logging. Requires mysql2 at runtime. Release cadence appears slow (v2.0.0 significant change from v1). Differentiator: zero global side-effects, NULL vs undefined semantics correctly map to IS NULL vs skip, and where(undefined) is a no-op for dynamic conditions. Ships TypeScript types. Requires Node.js >= 18 and TypeScript >= 4.7.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/EnochL/chill-sql","tags":["javascript","typesql","type-sql","type sql","type-safe sql","sql","typescript","mysql"],"install":[{"cmd":"npm install chill-sql","lang":"bash","label":"npm"},{"cmd":"yarn add chill-sql","lang":"bash","label":"yarn"},{"cmd":"pnpm add chill-sql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime database driver, not included by chill-sql","package":"mysql2","optional":false}],"imports":[{"note":"Main factory function, always from top-level module","wrong":"import { createMysqlClient } from 'chill-sql/query'","symbol":"createMysqlClient","correct":"import { createMysqlClient } from 'chill-sql'"},{"note":"mysql2 is a peer dependency, not bundled","wrong":"import { PoolOptions } from 'chill-sql'","symbol":"mysql2","correct":"import { PoolOptions } from 'mysql2'"},{"note":"Require works but lacks TypeScript types; prefer ESM","wrong":"const chillSql = require('chill-sql')","symbol":"chill-sql","correct":"import { createMysqlClient } from 'chill-sql'"}],"quickstart":{"code":"import { createMysqlClient } from 'chill-sql';\n\n// Define table schemas\ntype User = {\n    user_id: string;\n    user_name: string;\n    user_email?: string;\n};\n\ntype MyTables = { user: User };\n\n// Create client\nconst mysqlClient = createMysqlClient<MyTables>({\n    host: process.env.DB_HOST ?? 'localhost',\n    user: process.env.DB_USER ?? 'root',\n    password: process.env.DB_PASS ?? '',\n    database: process.env.DB_NAME ?? 'test',\n});\n\n// Query all users\nconst users = await mysqlClient.tables.user.select('*').exec();\n\n// Insert a user\nawait mysqlClient.tables.user.insert({ user_id: 'abc', user_name: 'Bob' }).exec();\n\n// Update with condition\nawait mysqlClient.tables.user.update({ user_email: 'bob@example.com' })\n    .where(e => e.user_id.eq('abc'))\n    .exec();","lang":"typescript","description":"Shows creating a MySQL client with table schemas, selecting all rows, inserting, and updating with a condition."},"warnings":[{"fix":"Migrate to v2.0.0 API: define table types, use mysqlClient.tables.tableName.select(...).exec() instead of the previous chain.","message":"v2.0.0 changed the API significantly from v1.x. The `mysqlClient.tables` pattern replaced older query builder. All existing code using the old API will break.","severity":"breaking","affected_versions":"<=1.x"},{"fix":"Use only documented public API: `exec()`, `toSqlQuery()` is public but not guaranteed stable; consider refactoring.","message":"Some users may rely on undocumented internal methods (e.g., `toSqlQuery`) that could be removed in future minor releases.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use null explicitly when you want to set a column to NULL, undefined when you want to omit the column from the query.","message":"NULL vs undefined: passing null to insert/update writes SQL NULL; passing undefined skips the field. Confusing if you expect undefined to become NULL.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'18':82 '4.7':85 'appear':42 'builder':9 'cadenc':41 'chang':46 'chill':2 'chill-sql':1 'condit':76 'correct':59 'creat':13 'defin':23 'delet':30 'differenti':49 'dynam':75 'effect':54 'full':17 'global':51 'infer':19 'insert':28 'javascript':86 'join':31 'log':35 'map':60 'mysql':7,99 'mysql2':37 'no-op':71 'node.js':81 'null':55,63 'op':73 'queri':8,15 'releas':40 'requir':36,80 'runtim':39 'safe':6,95 'schema':25 'select':27 'semant':58 'ship':77 'side':53 'side-effect':52 'signific':45 'skip':65 'slow':43 'sql':3,14,90,92,96,97 'subqueri':32 'support':26 'tabl':24 'transact':33 'type':5,79,89,91,94 'type-saf':4,93 'type-sql':88 'typescript':11,18,78,84,98 'typesql':87 'undefin':57,68 'updat':29 'user':22 'user-defin':21 'v1':48 'v2.0.0':12,44 'vs':56,64 'zero':50","created_at":"2026-06-05T16:55:17.045815+00:00","updated_at":"2026-06-05T16:55:17.045815+00:00","problems":[{"fix":"Run `npm install mysql2` or ensure it's in your package.json dependencies.","cause":"mysql2 is a peer dependency and must be installed separately.","error":"Cannot find module 'mysql2'"},{"fix":"Use `mysqlClient.tables.user.select('*').exec()` not `tables.user.select(...)`.","cause":"Using a table object directly instead of via mysqlClient.tables.tableName","error":"Property 'select' does not exist on type 'Table<...>'"}],"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/EnochL/chill-sql#readme","github":"https://github.com/EnochL/chill-sql","docs":null,"changelog":null,"pypi":null,"npm":"chill-sql","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}}