Select to view content in your preferred language

Is there a way to keep SDE connection "alive" with arcpy?

1742
3
Jump to solution
06-22-2021 12:40 PM
Labels (2)
EdgarRunnman
Emerging Contributor

I am using arcpy for som automated database editing and i am in need to connect or stay connected to SDE with db onwer account after i close SDE to new connections with db admin account.

It seems that python opens new SDE connection evry time arcpy method involving that dependency accours and "kills" it after method executions is finished.
Is there a way to keep connection "alive" so that i can use it after i disconnect all other conections and close sde to new connections?

0 Kudos
1 Solution

Accepted Solutions
mody_buchbinder
Frequent Contributor

Hi

I did not tried it but if you do a MakeFeatureLayer on one of the feature classes in SDE and do not delete this layer I think it will keep the connection open.

View solution in original post

3 Replies
mody_buchbinder
Frequent Contributor

Hi

I did not tried it but if you do a MakeFeatureLayer on one of the feature classes in SDE and do not delete this layer I think it will keep the connection open.

EdgarRunnman
Emerging Contributor

Hi

I had some doubts because of using reference to table and not layer limitation in "management.DisableEditorTracking", but your solutions did the job!!!
It seems that python keeps track of active sde connections instanses and uses them in firs hand.
Thanks for the tips!

0 Kudos
VinceAngelo
Esri Esteemed Contributor

Maintaining an open arcpy.ArcSDESQLExecute cursor would probably accomplish the same thing.