MySQLdb "begin()" -

S

shearichard

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 ...

Traceback (most recent call last):
'2.0'


Be interested in any comments.

regards

Richard.
 
G

Geoffrey Clements

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/
 
D

Dennis Lee Bieber

Hi - Feeling a bit weird about this but I cannot find the 'begin'
method on a connection object of MySQLdb. Can anyone explain why ?
There isn't one... Item 1) make sure MySQL is NOT set for
"auto-commit". Item 2) Transactions are implicitly started when a
statement is submitted via .execute (which is why you need to turn off
auto-commit, the .execute may be treated as a complete transaction other
wise)
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 !

Do you recall /where/ you "read that"?

--
 
S

shearichard

"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.
 
S

shearichard

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?option=content&task=view&id=210&pop=1&page=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.
 
D

Dennis Lee Bieber

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

http://www.devshed.com/index2.php?option=content&task=view&id=210&pop=1&page=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.
It also mentions Python 1.5.2 and a pre 4.x MySQL... Those are what,
a decade, old? Might have been DB-API 1.x compliant.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,197
Latest member
ปั๊มเฟส|JoyLikeSEO

Latest Threads

Top