CLI tool and API that inspects a MySQL, PostgreSQL, or MSSQL database and generates JavaScript definitions for the node-sql library. The current stable version is 1.5.0. It is released sporadically, with no fixed cadence. Key differentiator: it automates the creation of sql.define() statements by connecting directly to your database and introspecting tables and columns, saving manual schema mapping. Note: since v1.0.0, you must install the actual database drivers (mysql, pg, mssql) separately.
npm install sql-generateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows both CLI and API usage: connecting to a MySQL database and generating sql.define() definitions.
npm install mysql (or pg, mssql) alongside sql-generate.
Use 'node-sql-generate' as the command.
Install 'sql' (not 'sql.js' or 'sqlite3'): npm install sql.
Pass --schema if your tables are in a non-public schema.
Use require() or convert to ESM.
npm install mysql
Check that the database is accessible and the DSN is correct.
npm install sql