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, 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 8+ are supported.
Read the full documentation to get started!
Or check out our Recipes wiki to search for solutions to some specific problems
If upgrading from older version, see Upgrading instructions
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:
const 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;