Select to view content in your preferred language

Return list of users locking/using an object

387
1
05-08-2023 03:24 PM
JoseG_Esri
New Contributor II

Is there a way to return the list of users locking a distinct geodatabase object (feature class, object table, domain) using python/arcpy ?  if there is no way now, can this be added as a new feature..?

0 Kudos
1 Reply
Kara_Shindle
Regular Contributor

I once saw a blog post example for returning a list of connected users in order to send them an email before database reconciliation occurred.  Seems like that would be a good starting point.

That particular example in my code looks like the following:

 

 

 

sdeConnection = r"Insert/your/path/here"

#list users connected to database
userList = arcpy.ListUsers(sdeConnection)

# get a list of user names from the list of named tuples returned from ListUsers
userNames = [u.Name for u in userList]

mylist = list(dict.fromkeys(userNames))
#I removed a few extra characters to clean up the user list because I needed to create emails, so you'll have to work on this part to customize it to your needs
mylist.remove('DBO') 
mylist = [(name[10:-1]) for name in mylist ]

 

 

Edit:

Here is the link to the syntax doc.

 

Here is a GeoNet post where someone is working through the example I mentioned, & they link back to the original post.

0 Kudos