Select to view content in your preferred language

SDE Connection stucks

779
3
11-26-2019 04:37 AM
Vakhtang_Zubiashvili
Frequent Contributor

Hi Guys,

I have simple code in Arcpy to transfer attributes from one layer to another. It works for local gdb, but when i run it for SDE (It is versioned SDE connection)    it stusks and do not import anything, i think it is problem of connection string i have, but i do not know how to change it. Here is a very useful code for transferring values between two layers, when one intersects to other, you can use it and help me for SDE connetion:

mxd = arcpy.mapping.MapDocument("Current")


Pointi = r'Database Connections\Connection to 10.0.151.30.sde\WaterTbilisi_GIS.DBO.kanalizacia\WaterTbilisi_GIS.DBO.canals'
Poli = r'Database Connections\Connection to 10.0.151.30.sde\WaterTbilisi_GIS.DBO.samisamarTo_erTeulebi\WaterTbilisi_GIS.DBO.done_6'


with arcpy.da.UpdateCursor(Pointi, ['SHAPE@','updateField']) as ucursor:
        for update_row in ucursor:
             with arcpy.da.SearchCursor(Poli, ['SHAPE@', 'TargetField']) as scursor:
                  for search_row in scursor:
                       if update_row[0].within(search_row[0]):
                          update_row[1] = search_row[1]
                          ucursor.updateRow(update_row)

0 Kudos
3 Replies
JoshuaBixby
MVP Esteemed Contributor

Can you elaborate on where it is getting stuck?  Maybe add some print statements to the code so you can see what line is causing the issue.

0 Kudos
Vakhtang_Zubiashvili
Frequent Contributor

I use python add-in "onCreate new feature" and when i start editing and

click to make new point deature it stucks.

0 Kudos
MichaelVolz
Esteemed Contributor

Have you tried modifying the SDE connection to use the exact path instead of the shortcut path that you are using?

0 Kudos