• <bdo id='NInas'></bdo><ul id='NInas'></ul>

      1. <small id='NInas'></small><noframes id='NInas'>

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

        <legend id='NInas'><style id='NInas'><dir id='NInas'><q id='NInas'></q></dir></style></legend>
      2. <tfoot id='NInas'></tfoot>
      3. 如何在sqlalChemy.Engine.Connection中设置autoCommit=1

        how to set autocommit = 1 in a sqlalchemy.engine.Connection(如何在sqlalChemy.Engine.Connection中设置autoCommit=1)
        <i id='pY30p'><tr id='pY30p'><dt id='pY30p'><q id='pY30p'><span id='pY30p'><b id='pY30p'><form id='pY30p'><ins id='pY30p'></ins><ul id='pY30p'></ul><sub id='pY30p'></sub></form><legend id='pY30p'></legend><bdo id='pY30p'><pre id='pY30p'><center id='pY30p'></center></pre></bdo></b><th id='pY30p'></th></span></q></dt></tr></i><div id='pY30p'><tfoot id='pY30p'></tfoot><dl id='pY30p'><fieldset id='pY30p'></fieldset></dl></div>

              • <bdo id='pY30p'></bdo><ul id='pY30p'></ul>

                • <tfoot id='pY30p'></tfoot>

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

                    <tbody id='pY30p'></tbody>
                  <legend id='pY30p'><style id='pY30p'><dir id='pY30p'><q id='pY30p'></q></dir></style></legend>
                • 本文介绍了如何在sqlalChemy.Engine.Connection中设置autoCommit=1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在sqlalChemy中,我建立连接:

                   conn = engine.connect()
                  
                  我发现这将在我的mysqld日志中设置autoCommit=0。 现在我想设置autoCommit=1,因为我不想在事务中查询。

                  有办法做到这一点吗?

                  推荐答案

                  发件人The SQLAlchemy documentation: Understanding autocommit

                  conn = engine.connect()
                  conn.execute("INSERT INTO users VALUES (1, 'john')")  # autocommits
                  

                  只有在没有以其他方式声明Transaction的情况下,"自动提交"功能才有效。这意味着该功能通常不与ORM一起使用,因为默认情况下Session对象始终维护正在进行的Transaction

                  使用<[2-4],EngineExecutable上提供的生成性Connection.execution_options()方法,使用将打开或关闭选定作用域的自动提交的"autoCommit"标志,可以完全控制"自动提交"行为。例如,表示提交的存储过程的text()构造可能会使用它,以便SELECT语句将发出COMMIT:

                  engine.execute(text("SELECT my_mutating_procedure()").execution_options(autocommit=True))
                  

                  这篇关于如何在sqlalChemy.Engine.Connection中设置autoCommit=1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)

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

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

                            <tfoot id='zUtQo'></tfoot>
                              <tbody id='zUtQo'></tbody>