A lightweight Node.js MySQL query composer for building insert and update statements without an ORM. Version 2.0.3 simplifies dynamic SQL generation for scrapers and ETL tasks. Offers methods: insert, update, query, beginTransaction, rollback, commit. Unlike sequelize it does not require table modeling, but does not provide schema validation or migrations. Supports callbacks and optional promise wrappers. No active development since 2019.
npm install mysql-composerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic insert and update operations using Composer with mysql connection, including ignore flag and onDuplicateKeyUpdate.
Always include a 'where' property in the update config. Use '1' to update all rows.
Set ignore: false in the insert config to get errors on duplicate keys.
Use util.promisify or create wrapper functions to use async/await.
Consider migrating to a maintained library like knex or mysql2 with prepared statements.
Use require() instead of import. If using ES modules, create a dynamic import using createRequire.
Use 'new Composer(connection)' or ensure Composer is instantiated correctly.
Ensure mysql.createConnection returns a valid connection object and pass it to Composer.
Use proper SQL syntax in the where string; for string values, enclose in single quotes.
Always provide a callback function as the second argument, even if logging.