After mass loading a bunch of feature classes into a enterprise geodatabases (10.3.1, MSSQL), I need to add privileges for a role to many of them. I tested ChangePrivileges with a single feature class, it worked, so now I thought I would extend this by getting a list of feature classes, then using a For loop on the list to grant the privileges. But it didn't wok to set up the correct database connection as a env.workspace. What's the correct way to loop through a enterprise geodatabase to add permissions? Or do I want to do this in a totally different way? The following script gives a TypeError: 'NoneType' object is not iterable on debugging line 17, indicating I didn't get anything into the list.
<SPAN class="comment token"># ModPriv2lp.py</SPAN>
<SPAN class="comment token"># Testing how to modify enterprise geodatabase privileges with python</SPAN>
<SPAN class="comment token"># Paul Huffman, 2017-12-14</SPAN>
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Database Connections/Streams as GisOwner.sde"</SPAN>
<SPAN class="comment token">#get list of feature classes in geodatabase.</SPAN>
fclist <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN>
fclist <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses <SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Database Connections/Streams as GisOwner.sde"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#datasetName = "Database Connections/Streams as GisOwner.sde/Streams.GISOWNER.str37_route_rivers"</SPAN>
<SPAN class="comment token">#datasetName = "Streams.GISOWNER.str37_route_rivers"</SPAN>
<SPAN class="comment token">#arcpy.ChangePrivileges_management(datasetName, "GISUsers", "GRANT", "AS_IS")</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> fclist<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> fc
<SPAN class="comment token">#arcpy.ChangePrivileges_management(fc, "GISUsers", "GRANT", "AS_IS")</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>