Deleting rows using PyDO from SkunkWeb

M

Marcin Jurczuk

Hello group.
Could someone descripe how to delete many row at one time
from MySQL database using SkunkWeb PyDO pacgage ??
Documentation is very short about that ...
Assume that Base is class define like in PyDO doc, so
Base.new(...) adds new row..
Documetation show ony delete() without any arguments.
SQL query is like "DELETE FROM SESSIONS WHERE acc_time < '398984353'"

Thanks for read this :)
 
J

Jacob Smullyan

Marcin Jurczuk said:
Hello group.
Could someone descripe how to delete many row at one time
from MySQL database using SkunkWeb PyDO pacgage ??
Documentation is very short about that ...
Assume that Base is class define like in PyDO doc, so
Base.new(...) adds new row..
Documetation show ony delete() without any arguments.
SQL query is like "DELETE FROM SESSIONS WHERE acc_time < '398984353'"

I just came across this by accident; PyDO questions are better asked
on the skunkweb mailing list.

But to answer it quickly -- the delete() method deletes a particular
instance (one row). If you want delete a range of rows with a single
SQL statement, the best way is simply to use SQL, accessing the
underlying db connection:

c=Sessions.getDBI().conn.cursor()
c.execute("DELETE FROM SESSIONS WHERE acc_time < '333333'")
# this is equivalent to Sessions.getDBI().conn.commit()
Sessions.commit()

Hope that helps,

Jacob Smullyan
 
M

Marcin Jurczuk

But to answer it quickly -- the delete() method deletes a particular
instance (one row). If you want delete a range of rows with a single
SQL statement, the best way is simply to use SQL, accessing the
underlying db connection:

c=Sessions.getDBI().conn.cursor()
c.execute("DELETE FROM SESSIONS WHERE acc_time < '333333'")
# this is equivalent to Sessions.getDBI().conn.commit()
Sessions.commit()

Hope that helps,

Jacob Smullyan
Thx - I've wrote my own class to access SQL because it was faster than
searching answer for PyDO.
Next time will help :)
 

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,765
Messages
2,569,568
Members
45,042
Latest member
icassiem

Latest Threads

Top