I have created a Django app and tested the application's performance by populating some 10,0000 records. Now i want to delete it using a python script. Can somebody help me in doing this. This is the script i created to populate data into sql db.
def dumpdata(): for i in range(2,10): userName = "Bryan" designation = 'Technician ' employeeID = 2312 dateOfJoin = '2009-10-10' EmployeeDetails(userName= "Bryan",designation= 'Technician',employeeID= 2312,dateOfJoin= '2009-10-10').save() dumpdata()
To select a record, click the record selector next to the record, if the record selector is available. To extend or reduce the selection, drag the record selector (if it is available), or press SHIFT+DOWN ARROW or SHIFT+UP ARROW. Press DELETE, select Home > Records > Delete, or press Ctrl+Minus Sign (-).
The del keyword in python is primarily used to delete objects in Python. Since everything in python represents an object in one way or another, The del keyword can also be used to delete a list, slice a list, delete a dictionaries, remove key-value pairs from a dictionary, delete variables, etc.
You can remove an entire table using the DROP TABLE statement. You just need to specify the name of the table you need to delete.
If you want to delete a record from any MySQL table, then you can use the SQL command DELETE FROM. You can use this command at the mysql> prompt as well as in any script like PHP.
QuerySet.delete()
EmployeeDetails.objects.filter(...).delete()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With