应用程序运行时如何在控制台上显示sql?
http://knexjs.org/#Installation -debug
运行DEBUG=knex:query作为环境变量。
DEBUG=knex:query
或者在 knex 实例上使用.toString() 。
.toString()
并且 toSQL().toNative() 以发送到 sql 驱动程序的格式显示查询。 您还可以将打印连接到 knex.on('query', ...) 事件
作为记录,以下文档:
yourQuery.toSQL().toNative()
在这里: http ://knexjs.org/#Interfaces -toSQL
最有用的评论
http://knexjs.org/#Installation -debug
运行
DEBUG=knex:query
作为环境变量。或者在 knex 实例上使用
.toString()
。