question about deleting records from mysql

N

nephish

Hey there,
sorry , second question in as many days.
i am trying to do some stuff with MySQLdb and the thing is, i can
select records and such, but when i try to delete them, they dont
really go away.

like this
0L

so it looks like it worked, but when i use something else to look at
the
table (phpmyadmin, mysql-query-browser, knoda) the records are still
there!

what do i do?
 
S

Simon Brunning

Hey there,
sorry , second question in as many days.
i am trying to do some stuff with MySQLdb and the thing is, i can
select records and such, but when i try to delete them, they dont
really go away.

A fiver says you need to commit your changes.
 
M

Mage

nephish said:
Simon Brunning wrote:



ok, do i do that with cursor.commit() ?
thanks
Yes, or maybe you should write a lightweight layer between the dbapi and
your program which can turn on and off the autocommit by calling
"commit" and "begin" as query. I did this in my pgsql layer. Using
transactions every time is almost as bad as never using them.

Mage
 
N

nephish

ok. did this

i got an AttributeError 'Cursor' object has no attribute 'commit'

hmm. what should i do now?
the stuff about writing a lightweight layer between the dbapi and the
program shot right over my head. sorry, but thanks
 
R

Rowdy

ok. did this




i got an AttributeError 'Cursor' object has no attribute 'commit'

hmm. what should i do now?
the stuff about writing a lightweight layer between the dbapi and the
program shot right over my head. sorry, but thanks

IIRC it is the connection that can commit(), not the cursor.

Rowdy
 
N

nephish

Man, thanks for the link. and the tip. i am testing
the db.commit() and printing the doc right now.
thanks again.
 
C

Cantankerous Old Git

nephish said:
Man, thanks for the link. and the tip. i am testing
the db.commit() and printing the doc right now.
thanks again.

If it's any help, using

cursor.execute("set autocommit = 1")

before doing anything else works nicely unless you actually need
transactions.

The Cog
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top