New answers tagged versioning
You can create multiple .SDE file connections, each pointing to different versions. Then you can refer to the various versions in your code: arcpy.MakeFeatureLayer_management(r'Database Connections\readonlyCon.sde\GISADMIN.Buildings', 'Buildings_readonly') arcpy.MakeFeatureLayer_management(r'Database Connections\editorCon.sde\GISADMIN.Parcels', ...
You can get the state_id from the SDE_states table in your database. You could do a simple call to that table after your compress, something along the lines of: sql = "SELECT state_id FROM SDE_states WHERE name = "DEFAULT" You could use pyodbc probably, but many other solutions out there to connect to and query databases from Python.
Top 50 recent answers are included