Hi all,
I work with an arcSDE database (SQL server Enterprise geodatabase) and I want to retrive using python code the modification date of each of its elements (tables, features classes, rasters, ...)
Thanks
Hi Said,
When you say modified date, do you mean table structure or last updated/added row?
I Mean last feauture class modification or the date of creation
Thanks for your quick answer
This is something that can be done by sending SQL queries to your SDE repository tables to get the created UNIX time from the sde_table_registry and convert that to a more standard time. I have attached a script I have used to perform this in the past and write it out to a logfile.
However, this should be enough to get you started on how to access and convert the registration time in your Enterprise Geodatabase.
import arcpy, os, datetime, time workPath = r"Database Connections\Connection to cwells.sde" arcpy.CreateDatabaseView_management(workPath, viewName, "select database_name, owner, table_name, registration_date from sde.sde_table_registry") for row in arcpy.SearchCursor(os.path.join(workPath, viewName)): tableName = row.getValue("DATABASE_NAME") + "." + row.getValue("OWNER") + "." + row.getValue("TABLE_NAME") cDate = row.getValue("REGISTRATION_DATE") dTime = time.strftime('%d-%b-%Y %H:%M:%S', time.localtime(cDate))
Is there a possibility to have just one date or the date creation or a last modification of a feature class instead of looping in all rows
I'm not sure of your exact question, but are you asking if its possible to return a date for a single feature class only?
Thanks. This is really helpful
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.