• <small id='6LUri'></small><noframes id='6LUri'>

    <tfoot id='6LUri'></tfoot><legend id='6LUri'><style id='6LUri'><dir id='6LUri'><q id='6LUri'></q></dir></style></legend>

      • <bdo id='6LUri'></bdo><ul id='6LUri'></ul>

      <i id='6LUri'><tr id='6LUri'><dt id='6LUri'><q id='6LUri'><span id='6LUri'><b id='6LUri'><form id='6LUri'><ins id='6LUri'></ins><ul id='6LUri'></ul><sub id='6LUri'></sub></form><legend id='6LUri'></legend><bdo id='6LUri'><pre id='6LUri'><center id='6LUri'></center></pre></bdo></b><th id='6LUri'></th></span></q></dt></tr></i><div id='6LUri'><tfoot id='6LUri'></tfoot><dl id='6LUri'><fieldset id='6LUri'></fieldset></dl></div>

      1. 打印 MySQLdb 运行的实际查询?

        Print the actual query MySQLdb runs?(打印 MySQLdb 运行的实际查询?)
        <legend id='V9Qkk'><style id='V9Qkk'><dir id='V9Qkk'><q id='V9Qkk'></q></dir></style></legend>

          <small id='V9Qkk'></small><noframes id='V9Qkk'>

                <tbody id='V9Qkk'></tbody>
                <i id='V9Qkk'><tr id='V9Qkk'><dt id='V9Qkk'><q id='V9Qkk'><span id='V9Qkk'><b id='V9Qkk'><form id='V9Qkk'><ins id='V9Qkk'></ins><ul id='V9Qkk'></ul><sub id='V9Qkk'></sub></form><legend id='V9Qkk'></legend><bdo id='V9Qkk'><pre id='V9Qkk'><center id='V9Qkk'></center></pre></bdo></b><th id='V9Qkk'></th></span></q></dt></tr></i><div id='V9Qkk'><tfoot id='V9Qkk'></tfoot><dl id='V9Qkk'><fieldset id='V9Qkk'></fieldset></dl></div>

                <tfoot id='V9Qkk'></tfoot>
                  <bdo id='V9Qkk'></bdo><ul id='V9Qkk'></ul>
                • 本文介绍了打印 MySQLdb 运行的实际查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一种在执行查询时调试查询的方法,我想知道是否有办法让 MySQLdb 在完成插入参数和所有这些之后打印出它运行的实际查询?从文档来看,似乎应该有一个 Cursor.info() 调用来提供有关上次查询运行的信息,但这在我的版本 (1.2.2) 上不存在.

                  I'm looking for a way to debug queries as they are executed and I was wondering if there is a way to have MySQLdb print out the actual query that it runs, after it has finished inserting the parameters and all that? From the documentation, it seems as if there is supposed to be a Cursor.info() call that will give information about the last query run, but this does not exist on my version (1.2.2).

                  这似乎是一个显而易见的问题,但经过我的所有搜索,我一直无法找到答案.提前致谢.

                  This seems like an obvious question, but for all my searching I haven't been able to find the answer. Thanks in advance.

                  推荐答案

                  我们在游标对象上发现了一个名为 cursor._last_executed 的属性,即使发生异常,它也会保存要运行的最后一个查询字符串.这对我们在生产中的生产来说比一直使用分析或 MySQL 查询日志更容易、更好,因为这两者都会影响性能并且涉及更多代码或更多相关的单独日志文件等.

                  We found an attribute on the cursor object calledcursor._last_executed that holds the last query string to run even when an exception occurs. This was easier and better for us in production than using profiling all the time or MySQL query logging as both of those have a performance impact and involve more code or more correlating separate log files, etc.

                  不想回答我自己的问题,但这对我们来说效果更好.

                  Hate to answer my own question but this is working better for us.

                  这篇关于打印 MySQLdb 运行的实际查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)

                  <legend id='GJYVn'><style id='GJYVn'><dir id='GJYVn'><q id='GJYVn'></q></dir></style></legend>
                  • <tfoot id='GJYVn'></tfoot>

                      <small id='GJYVn'></small><noframes id='GJYVn'>

                        <bdo id='GJYVn'></bdo><ul id='GJYVn'></ul>
                            <tbody id='GJYVn'></tbody>
                          <i id='GJYVn'><tr id='GJYVn'><dt id='GJYVn'><q id='GJYVn'><span id='GJYVn'><b id='GJYVn'><form id='GJYVn'><ins id='GJYVn'></ins><ul id='GJYVn'></ul><sub id='GJYVn'></sub></form><legend id='GJYVn'></legend><bdo id='GJYVn'><pre id='GJYVn'><center id='GJYVn'></center></pre></bdo></b><th id='GJYVn'></th></span></q></dt></tr></i><div id='GJYVn'><tfoot id='GJYVn'></tfoot><dl id='GJYVn'><fieldset id='GJYVn'></fieldset></dl></div>