A SQL query builder that is flexible, portable, and fun to use!
A batteries-included, multi-dialect (MSSQL, MySQL, PostgreSQL, SQLite3, Oracle(including Oracle Wallet Authentication)) query builder for Node.js and the Browser, featuring:
- connection pooling
- streaming queries
- both a promise and callback API
- a thorough test suite
- the ability to run in the Browser
Node.js versions 6+ are supported.
For support and questions, join the
#bookshelf channel on freenode IRC
For an Object Relational Mapper, see:
To see the SQL that Knex will generate for a given query, see: Knex Query Lab
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;