468,533 Members | 1,892 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,533 developers. It's quick & easy.

MySQLdb "begin()" -

Hi - Feeling a bit weird about this but I cannot find the 'begin'
method on a connection object of MySQLdb. Can anyone explain why ?

I'm using version 1.2.0 which is pretty recent and I've read that
'begin' should be a method of connection but it's not there ! Feeling
pretty puzzled !

Below are the details of what I see ...

import MySQLdb
c= MySQLdb.Connect(host='localhost', user='a',passwd='b', db='c',compress=1)
c.begin() Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'Connection' object has no attribute 'begin' o=MySQLdb
o.__version__ '1.2.0' o.__revision__ '1.37' o.apilevel

'2.0'
Be interested in any comments.

regards

Richard.

Apr 25 '06 #1
3 2510
<sh*********@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi - Feeling a bit weird about this but I cannot find the 'begin'
method on a connection object of MySQLdb. Can anyone explain why ?

I'm using version 1.2.0 which is pretty recent and I've read that
'begin' should be a method of connection but it's not there ! Feeling
pretty puzzled !


What exactly do you expect a begin method to do? Have you read this:
http://www.python.org/dev/peps/pep-0249/

--
Geoff
Apr 25 '06 #2
"What do i expect the begin method to do" ?

Explicitly start a transaction (and therefore suppress autocommits) in
an environment where autocommit is on.

No i haven't read the pep, thanks for that.

Apr 26 '06 #3
Thanks for your advice. In fact subsquent to posting I started using
....

conn.autocommit = False

.... as a synonm for ...

conn.begin()

.... and as you say that does the job. (Sorry i should have said it's
not practicable to turn off autocommit always [or rather it may be but
I'm not about to shake the boat to that extent just now ;-]

As to what I was reading yes it's here ...

http://www.devshed.com/index2.php?op...ge=0&hide_js=1

.... or more succinctly ...

http://tinyurl.com/s6yd2

.... page down to ...

"connection.begin() - start a transaction"

.... that article refers to version 0.92 of MySQLdb so clearly it was
either wrong then or for some weird reason the method has been dropped.

thanks again.

richard.

Apr 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ravi | last post: by
1 post views Thread by Sean Dettrick | last post: by
5 posts views Thread by Jim West | last post: by
4 posts views Thread by Generic Usenet Account | last post: by
6 posts views Thread by Gaijinco | last post: by
reply views Thread by mailforpr | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.