AnsweredAssumed Answered

List Feature Classes in Database

Question asked by jfuto033 on Aug 22, 2017
Latest reply on Aug 22, 2017 by mbabinski1988

I'm trying to create a list of features classes inside of our LGIM database for handouts to staff.  I can successfully print out a list of all of the feature classes using the code below, but I want to only list feature classes that have content in them.  Does anyone have a script they could share? Or has anyone done this before?  If it helps, the data I'm trying to access is in SDE.

 

Code:

import arcpy

import os

arcpy.env.workspace = "c:/base/gdb.gdb"

datasets = arcpy.ListDatasets(feature_type='feature')

datasets = [''] + datasets if datasets is not None else []

for ds in datasets:

    for fc in arcpy.ListFeatureClasses(feature_dataset=ds):

        path = os.path.join(arcpy.env.workspace, ds, fc)

        print(path)

 

Outcomes