Seems a lot of wrappers are moving away from autocommit for performance reasons. <br>
pysqlite has removed it as of the alphra 2.0<br><br><div><span class="gmail_quote">On 4/20/05, <b class="gmail_sendername">Danny Yoo</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br>On Tue, 19 Apr 2005 <a href="mailto:email@example.com">firstname.lastname@example.org
</a> wrote:<br><br>> hi all, while recently trying to insert some data into the following<br>> table:<br>><br>> # stores unique course definitions<br>> CREATE TABLE adminCourses (<br>> ID TINYINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
<br>> Code CHAR(6),<br>> Title VARCHAR(55),<br>> Units TINYINT UNSIGNED<br>> ) TYPE = InnoDB;<br>><br>> I got a 1L value when I ran the following:<br>><br>> cursor.execute("INSERT INTO adminCourses(ID, Code, Title, Units) VALUES
<br>> (NULL, 'EAT100', 'Josue', 30);")<br><br>Hi Tpc,<br><br>Do you know if MySQLdb still continues to use AUTOCOMMIT mode, or has this<br>been changed in new releases of the module? According to PEP 249:<br><br>
<a href="http://www.python.org/peps/pep-0249.html">http://www.python.org/peps/pep-0249.html</a><br><br>Database modules that conform to the standard are required to keep from<br>doing autocommits:<br><br>"""
any pending transaction to the database. Note that<br> if
the database supports an auto-commit feature, this must<br> be initially off. An interface method may be provided to<br> turn it back on.<br>"""<br><br>But MySQL didn't have transactions for the longest time, so this never
<br>really worked well until MySQL4 with InnoDB table support.<br><br>Now that MySQL is using transactions, it's possible that MySQLdb may have<br>autocommit off by default now. In fact, it looks like it, as there's a<br>
snippet of code in the driver now with the following:<br><br>######<br> self._transactional = (self.server_capabilities &<br>
CLIENT.TRANSACTIONS)<br> if self._transactional:<br> # PEP-249 requires autocommit to be initially off<br> self.autocommit(0)<br>######<br><br>Ah, ok, so it does look like MySQL now doesn't autocommit by default.
<br>That's new: I'll have to remember that.<br><br>Try doing a conn.commit() at the end of your database programs.<br><br>Best of wishes to you!<br><br>_______________________________________________<br>Tutor maillist -
<a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br><br><br>-- <br>'There is only one basic human right, and that is to do as you damn well please.
<br>And with it comes the only basic human duty, to take the consequences.'