fiendniu

Fast way to delete row from table

Discussion created by fiendniu on Mar 6, 2012
Latest reply on Mar 7, 2012 by fiendniu
hi, all

I am trying to delete row from file geodatabase table using following code:
import arcpy
import math

arcpy.env.workspace = r'C:\TempArcGISCalculate\Scratch.gdb'
arcpy.env.overwriteOutput = True

intable="Section0011"

Statstbl="C:/TempArcGISCalculate/Scratch.gdb/S11FirstStats"
Query = '"FREQUENCY"=1'

records = arcpy.SearchCursor(Statstbl,Query)
singlelst = []
for record in records:
    singlelst.append(record.getValue('Trace')) # it adds data who has single point only

del records
del record


pts = arcpy.UpdateCursor(intable)

for pt in pts:
    for i in singlelst:
        if pt.Trace == int(i):
            print "Deleting:", pt.OBJECTID, pt.Trace
            pts.deleteRow(pt)

del pts, pt            


In the table "Section0011", I have 534975 rows. When the script runs, it only remove about 1000 rows in couple hours, but has not finished yet. Is there any fast way to run deleteRow? please help

Thanks lot

Outcomes