Home > Notes > pymysql

pymysql delete dynamic

pymysql delete dynamic

Python Delete Dynamic Operation

The Below Example is for Delete Dynamic operation.

import pymysql
 conn = pymysql.connect(
        host='localhost',
        user='root',
        password="12345",
        db='sakila',
 )
 get_id = int(input("enter the id"))
 cur = conn.cursor()
 q1 = "delete from student where id = %s"
 cur.execute(q1,get_id)
 conn.commit()
 print("record deleted sucessfully")
 conn.close()