OpenSql is a promise-based ORM for MySQL, PostgreSQL, and Microsoft SQL Server, providing a unified API for database operations with TypeScript support. The current stable version is 2.2.2, released under MIT license. It features a simple configuration, promise-based queries, and multi-database support. Compared to alternatives like Sequelize or TypeORM, OpenSql focuses on a lightweight API and ease of use.
npm install opensqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MySQL using environment variables, runs a SELECT query, and logs the result.
Use `import { OpenSql } from 'opensql'` instead of `import OpenSql from 'opensql'`.Access results as array elements, e.g., `result[0]`.
Install `mysql2` for MySQL, `pg` for PostgreSQL, or `mssql` for SQL Server.
Use `import { OpenSql } from 'opensql'`.Run `npm install mysql2`.
Check that MySQL is running and that host/port are correct in config.