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
Thanks. This is really helpful
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?
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
Hi Said,
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))
I Mean last feauture class modification or the date of creation
Thanks for your quick answer
When you say modified date, do you mean table structure or last updated/added row?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.