I would like to iterate a geodatabse to get the name of each feature class/data set in it, in addition to the number of rows in the feature class. I would also like to identify whether the dataset that is being printed is a feature class or feature dataset.
The code that I have now prints each feature class and feature data set; but does not denote whether if the object printed is a feature class or feature data set. How would I print the number of rows per feature class in addition to denote whether if it is a feature class or feature dataset?
I am using ArcGIS Desktop 10.0 and a direct connect via spatial database.
import arcpy
arcpy.env.workspace='myworkspace'
datasetList = arcpy.ListDatasets("*", "Feature")
for dataset in datasetList:
print dataset
fcList = arcpy.ListFeatureClasses("*","",dataset)
fcList.sort()
for fc in fcList:
print fc
for fc in fcList:
arcpy.GetCount_management(fc)
Sample Output:
SDEDEV.SDE.Boundaries
SDEDEV.SDE.CTYA_GLEN
SDEDEV.SDE.ZipCode
SDEDEV.SDE.Streets
SDEDEV.SDE.CAMS_Streets_2012
SDEDEV.SDE.ROW
SDEDEV.SDE.Streets_COG