knex.js
A SQL query builder that is flexible, portable, and fun to use!
A batteries-included, multi-dialect (MySQL, PostgreSQL, SQLite3, WebSQL) query builder for Node.js and the Browser, featuring:
- transactions
- connection pooling
- streaming queries
- both a promise and callback API
- a thorough test suite
- the ability to run in the Browser
Read the full documentation to get started!
For support and questions, join the #bookshelf channel on freenode IRC
For an Object Relational Mapper, see: http://bookshelfjs.org
Examples
We have several examples on the website. Here is the first one to get you started:
var knex = dialect: 'sqlite3' connection: filename: './data.db' ; // Create a tableknexschema // ...and another // Then query the table... // ...and using the insert id, insert into the other table. // Query both of the rows. // .map over the results // Finally, add a .catch handler for the promise chain;