I am implementing Esri's python script to batch reconcile and post versions of our Enterprise Geodatabase running on SQL Server. The script is found here and would be run from our server using Task Scheduler. Instead of automatically disconnecting users from the database after a set period, we would like to check whether a user has an open edit session going. If there is an active edit session, instead of disconnecting the user and losing any edits they may have made, the script would not be run.
Currently, the script set to run only if there are no other users connected besides the administrator, i.e. if a Map Document is left open overnight on a Desktop the script won't run. This is a blanket fix and I would prefer that the script still run if the open map document isn’t being actively edited.
Is there a way to check if a user connected to the database is in an edit session?
I found this, which may have some things to try
This may be more of an ArcMap tool, but I'm looking at it too since testing for edit sessions would be handy for me too (right now, I manually use the SDE Database administrator and look for locks).
I have seen other post tools for running nightly rec/post and compress too, and my guess is they check for edit sessions too. I don't have one of those thread at my finger tips, but might be worth a search.
My guess is you've already seend the help to get a list of the connected users.
Think I found it......I'm testing and will add a post
EDIT: this looks like it should work, but I'm getting False even after opening a session. I am testing against a version SDE with topology.
import arcpy myConn = r'Database Connections\me@myData.sde' arcpy.da.Editor(myConn).isEditing
btw - I converted you document to a question. You should get more views/responses.