Currently there is a gap between what you can do in ArcMap and what you can do with the arcpy mapping module. In particular I would like to see the Layer Class properties to be expanded. Specifically the data driven page properties within a layers definition query. I was thinking along the lines of something like the LabelClass but for definition queries instead.
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.layerdefinition is True:
print "Layer name: " + lyr.name
print " Layer Definition: " + lyr.layerdefinition.expression
print " Page Definition Enabled: " + lyr.layerdefinition.pagedefinition
print " Page Definition Expression: " + lyr.layerdefinition.pagedefinitionexpression
I have just dealt with a data-model change that saw a bunch of fields get consolidated better through out our business and now I am faced with the prospect of changing 100+ mxd's to a new data structure with most having data driven pages driven from one of the fields that was changed. No Drama just script the update however the page definition is the one attribute I am now unable to update and have to now go through manually and correct these.