I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy. (EDIT, see further below: there is possibly also a way to do it via OGR in QGIS).
The file geodatabase structure is as follows:
my_geodb.gdb |----Feature_Dataset1 |----Table1 |----Table2 |----Table3 |----Table4 |...
I have gotten as far as doing this with a bit of help from here:
import arcpy arcpy.env.workspace = my_geodb.gdb oldws = arcpy.env.workspace #saves this as main workspace featureDatasets = arcpy.ListDatasets() #lists all datasets in geodb for fd in featureDatasets: arcpy.env.workspace = oldws + "\\" + fd featureClasses = arcpy.ListFeatureClasses() for fc in featureClasses: count = arcpy.GetCount_management(fc).getOutput(0) print fc, count
It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.
Trying to go with the way of ogr in qgis now. Referencing this.
Still need to work out the code to do so.