I created a version called GIS.GIS Data so that operators out in the field could GPS data and I could review it and post the edits to my own version before reaching the Default. My only concern is that our current reconcile and post scripts is grabbing data from each of the child versions under the Default each night. Is there a command in python that would exclude any child versions created underneath another child version from being reconciled and posted to the default? I am very new to the workflow and I would really appreciate some guidance. Thanks

<SPAN class="keyword token">import</SPAN> arcpy<SPAN class="punctuation token">,</SPAN> time<SPAN class="punctuation token">,</SPAN> smtplib<SPAN class="punctuation token">,</SPAN> os
deleteVersions <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
reconcileLog <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\temp\Daily_Reconcile_Log\Reconcile_Log.txt'</SPAN>
<SPAN class="comment token"># set the workspace</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">'C:\Users\jnmiller\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\SDE.sde'</SPAN>
<SPAN class="comment token"># Set a variable for the workspace</SPAN>
adminConn <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace
<SPAN class="comment token"># Block new connections to the database.</SPAN>
<SPAN class="comment token">#print("The database is no longer accepting connections")</SPAN>
<SPAN class="comment token">#arcpy.AcceptConnections(adminConn, False)</SPAN>
<SPAN class="comment token"># Wait 15 minutes</SPAN>
<SPAN class="comment token">#time.sleep(900)</SPAN>
<SPAN class="comment token"># Disconnect all users from the database.</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Disconnecting all users"</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>DisconnectUser<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ALL"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Get a list of versions to pass into the ReconcileVersions tool.</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Getting list of all versions"</SPAN><SPAN class="punctuation token">)</SPAN>
versionList <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListVersions<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> version <SPAN class="keyword token">in</SPAN> versionList<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="string token">'default'</SPAN> <SPAN class="keyword token">in</SPAN> version<SPAN class="punctuation token">.</SPAN>lower<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="string token">'dbo'</SPAN> <SPAN class="keyword token">in</SPAN> version<SPAN class="punctuation token">.</SPAN>lower<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
defaultVersion <SPAN class="operator token">=</SPAN> <SPAN class="string token">'dbo.DEFAULT'</SPAN>
<SPAN class="keyword token">elif</SPAN> <SPAN class="string token">'sde'</SPAN> <SPAN class="keyword token">in</SPAN> version<SPAN class="punctuation token">.</SPAN>lower<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
defaultVersion <SPAN class="operator token">=</SPAN> <SPAN class="string token">'sde.DEFAULT'</SPAN>
<SPAN class="comment token"># Execute the ReconcileVersions tool.</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Reconciling/posting/deleting all versions"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> deleteVersions<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ReconcileVersions_management<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ALL_VERSIONS"</SPAN><SPAN class="punctuation token">,</SPAN> defaultVersion<SPAN class="punctuation token">,</SPAN> versionList<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"LOCK_ACQUIRED"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NO_ABORT"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"BY_OBJECT"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FAVOR_EDIT_VERSION"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"POST"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"DELETE_VERSION"</SPAN><SPAN class="punctuation token">,</SPAN> reconcileLog<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">except</SPAN><SPAN class="punctuation token">:</SPAN>
reconcileMessage <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Reconcile failed: "</SPAN> <SPAN class="operator token">+</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetMessages<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">". Check reconcilelog.txt file in the "</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>reconcileLog<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddWarning<SPAN class="punctuation token">(</SPAN>reconcileMessage<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">pass</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ReconcileVersions_management<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ALL_VERSIONS"</SPAN><SPAN class="punctuation token">,</SPAN> defaultVersion<SPAN class="punctuation token">,</SPAN> versionList<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"LOCK_ACQUIRED"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NO_ABORT"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"BY_OBJECT"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FAVOR_EDIT_VERSION"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"POST"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"KEEP_VERSION"</SPAN><SPAN class="punctuation token">,</SPAN> reconcileLog<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">except</SPAN><SPAN class="punctuation token">:</SPAN>
reconcileMessage <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Reconcile failed: "</SPAN> <SPAN class="operator token">+</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetMessages<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">". Check reconcilelog.txt file in the "</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>reconcileLog<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddWarning<SPAN class="punctuation token">(</SPAN>reconcileMessage<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">pass</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Completed Reconcile & Post"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Run the compress tool. </SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Running compress"</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Compress_management<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Compress Completed"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Allow the database to begin accepting connections again</SPAN>
<SPAN class="comment token">#print("Allow users to connect to the database again")</SPAN>
<SPAN class="comment token">#arcpy.AcceptConnections(adminConn, True)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Starting Rebuild Indexes"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Get a list of all the datasets the user has access to.</SPAN>
<SPAN class="comment token"># First, get all the stand alone tables, feature classes and rasters.</SPAN>
dataList <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListTables<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListRasters<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Next, for feature datasets get all of the datasets and featureclasses</SPAN>
<SPAN class="comment token"># from the list and add them to the master list.</SPAN>
<SPAN class="keyword token">for</SPAN> dataset <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListDatasets<SPAN class="punctuation token">(</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Feature"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">,</SPAN>dataset<SPAN class="punctuation token">)</SPAN>
dataList <SPAN class="operator token">+=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListDatasets<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Get the user name for the workspace</SPAN>
userName <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Describe<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>connectionProperties<SPAN class="punctuation token">.</SPAN>user<SPAN class="punctuation token">.</SPAN>lower<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># remove any datasets that are not owned by the connected user.</SPAN>
userDataList <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>ds <SPAN class="keyword token">for</SPAN> ds <SPAN class="keyword token">in</SPAN> dataList <SPAN class="keyword token">if</SPAN> ds<SPAN class="punctuation token">.</SPAN>lower<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>find<SPAN class="punctuation token">(</SPAN><SPAN class="string token">".%s."</SPAN> <SPAN class="operator token">%</SPAN> userName<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">></SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="comment token"># Execute rebuild indexes</SPAN>
<SPAN class="comment token"># Note: to use the "SYSTEM" option the workspace user must be an administrator.</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>RebuildIndexes_management<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"SYSTEM"</SPAN><SPAN class="punctuation token">,</SPAN> userDataList<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ALL"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Rebuild Complete'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Update statistics on the system tables</SPAN>
<SPAN class="comment token"># print("Updating statistics on the system tables")</SPAN>
<SPAN class="comment token"># Execute analyze datasets</SPAN>
<SPAN class="comment token"># Note: to use the "SYSTEM" option the workspace user must be an administrator.</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AnalyzeDatasets_management<SPAN class="punctuation token">(</SPAN>adminConn<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"SYSTEM"</SPAN><SPAN class="punctuation token">,</SPAN> userDataList<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ANALYZE_BASE"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"ANALYZE_DELTA"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"ANALYZE_ARCHIVE"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Analyze Complete"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Finished."</SPAN><SPAN class="punctuation token">)</SPAN>
<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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>