Select to view content in your preferred language

How to use Arcpy to access feature classes outside of feature datasets in an sde connection?

646
1
12-09-2019 03:28 PM
AndrewCampbell2
Emerging Contributor

Hi, 

I'm finding that python is crashing each time I request feature classes using ArcPy when the default workspace is set to an sde connection. I have feature classes that are not within feature datasets. Currently, the only way that I am able to access these feature classes outside of the feature datasets is by using the following code:

for root, dirs, datasets in arcpy.da.Walk(workspace):

      for ds in datasets:

            print(os.path.join(root, ds))

However, this returns every item in the sde which is far more than I need and when I put a datatype filter in the Walk method it crashes the program (i.e. datatype = 'FeatureClass').

ArcPy also crashes when I run arcpy.ListFeatureClasses() with the sde workspace set to default. 

Am I missing something obvious?

Any insight would be really appreciated. 

Thanks 

 

Tags (3)
0 Kudos
1 Reply
awd
by
New Contributor

Was this ever resolved? I am having the same exact issue now and I am clueless as to why? I have two scripts, it works fine in one and crashes in the other. Makes no sense! Can @esri help?

0 Kudos