Home > Notes > pymysql

pymysql delete static

pymysql delete static

Python delete Static Operation

here everything will be same , expect we are not taking anything from the database. Rather we are putting the data to the database. commit() Method. This method sends a COMMIT statement to the MySQL server, committing the current transaction. Since by default Connector/Python does not autocommit, it is important to call this method after every transaction that modifies data for tables that use transactional storage engines.

 import pymysql
 conn = pymysql.connect(
        host='localhost',
        user='root',
        password="12345",
        db='sakila',
 )
 cur = conn.cursor()
 str1_query = "delete from student where id = 12"
 cur.execute(str1_query)
 conn.commit()
 print("record deleted sucessfully")
 conn.close()