Select to view content in your preferred language

Access featureclass within dataclass with SearchCursor from SDE

02-09-2022 09:10 AM
New Contributor II


I am trying to use the SearchCursor on a featureclass that is in a dataset that I access with an SDE - but I can't get it to work.

I have following structure in the SDE-server:

I want to access sde_geopipe.pipeWaterPipe with SearchCursor - I have the following code:


arcpy.env.workspace = './data/AD@sde_geopipe_uva.sde'
with arcpy.da.SearchCursor('sde_geopipe.Water/sde_geopipe.pipeWaterPipe', field) as cursor:
    for row in cursor:




I also tried to specify the full path ('./data/AD@sde_geopipe_uva.sde/sde_geopipe_uva.GNG.Vatten/sde_geopipe_uva.GNG.pipeWaterPipe') but that didn't work.

0 Kudos
2 Replies
New Contributor II

It looks like you're missing required syntax for field names:

I believe your line print(row[1])  would be looking for a second field passed as syntax.  The reason I say the second is because row[0] would be the first.

SearchCursor (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause}, {datum_transformation})

0 Kudos
New Contributor II

Thanks for your reply, unfortunately when I have the field parameter I get the following error:

RuntimeError: cannot open 'sde_geopipe.Water/sde_geopipe.pipeWaterPipe'

0 Kudos