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.
Layer—Help | ArcGIS Desktop
<SPAN class="keyword token">import</SPAN> arcpy
mxd <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>MapDocument<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"C:\Project\Project.mxd"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> lyr <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListLayers<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> lyr<SPAN class="punctuation token">.</SPAN>supports<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"LAYER_DEFINITION"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> lyr<SPAN class="punctuation token">.</SPAN>layerdefinition <SPAN class="keyword token">is</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Layer name: "</SPAN> <SPAN class="operator token">+</SPAN> lyr<SPAN class="punctuation token">.</SPAN>name
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">" Layer Definition: "</SPAN> <SPAN class="operator token">+</SPAN> lyr<SPAN class="punctuation token">.</SPAN>layerdefinition<SPAN class="punctuation token">.</SPAN>expression
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">" Page Definition Enabled: "</SPAN> <SPAN class="operator token">+</SPAN> lyr<SPAN class="punctuation token">.</SPAN>layerdefinition<SPAN class="punctuation token">.</SPAN>pagedefinition
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">" Page Definition Expression: "</SPAN> <SPAN class="operator token">+</SPAN> lyr<SPAN class="punctuation token">.</SPAN>layerdefinition<SPAN class="punctuation token">.</SPAN>pagedefinitionexpression
<SPAN class="keyword token">del</SPAN> mxd<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.