你如何让Korma输出它将执行的SQL?

时间:2013-03-19 18:01:34

标签: clojure korma

我正在尝试让Korma输出它将执行的SQL,这样我就可以调试我遇到的问题,但是文档对于如何使用as-sql函数非常简洁。谁能给我一个如何让Korma为INSERT查询输出SQL的例子?

2 个答案:

答案 0 :(得分:8)

来自:http://sqlkorma.com/api/0.3.0/korma.core.html

dry-run
(dry-run & body)
Wrap around a set of queries to print to the console all SQL that would 
be run and return dummy values instead of executing them.

答案 1 :(得分:5)

如果要将SQL查询作为字符串获取,还有sql-only

(println     
    (sql-only
        (select users)))
相关问题