I'm not having luck with the GlobalID and ParentGlobalID columns when attempting to populate Feature Classes and Tables in a FGDB from a hosted feature service. It's all fairly straight forward and seems to work just fine, except for when specifying these two fields.
Issues:
1. The GlobalId field does not seem to throw any error, however the feature classes get populated with the value: {00000000-0000-0000-0000-000000000000}
2. There's also related feature classes that contain a ParentGlobalID column as well, these throw an error when attempting to load the feature set "RuntimeError: RecordSetObject: Cannot open table for Load". If I remove the "ParentGlobalID" column from my list of fields to download, then the process works fine without error (minus the ParentGlobalID column of course).
This is the important section:
fields <SPAN class="operator token">=</SPAN> <SPAN class="string token">"""objectid,globalid,SurveyStartTime,SurveyEndTime,CreationDate,Creator,EditDate,Editor"""</SPAN>
taburl <SPAN class="operator token">=</SPAN> <SPAN class="operator token"><</SPAN>URLtoHostedFeatureService<SPAN class="operator token">></SPAN><SPAN class="operator token">/</SPAN>query<SPAN class="operator token">/</SPAN><SPAN class="number token">0</SPAN>
where <SPAN class="operator token">=</SPAN> <SPAN class="string token">'1=1'</SPAN>
query <SPAN class="operator token">=</SPAN> <SPAN class="string token">"?where={}&outFields={}&returnGeometry=true&f=json&token={}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>where<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'*'</SPAN><SPAN class="punctuation token">,</SPAN> token<SPAN class="punctuation token">)</SPAN>
queryfsURL <SPAN class="operator token">=</SPAN> taburl <SPAN class="operator token">+</SPAN> query
<SPAN class="comment token">#try to convert the hosted service to a fgdb table</SPAN>
fs <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>FeatureSet<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
fs<SPAN class="punctuation token">.</SPAN>load<SPAN class="punctuation token">(</SPAN>queryfsURL<SPAN class="punctuation token">)</SPAN>
fs<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN>r'<SPAN class="operator token"><</SPAN>pathToDirectory<SPAN class="operator token">></SPAN>\downloadTab<SPAN class="punctuation token">.</SPAN>gdb\HostedFsNameHere<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#also attempted this</SPAN>
<SPAN class="comment token">#arcpy.CopyRows_management(fs, r'<pathToDirectory>\downloadTab.gdb\HostedFsNameHere)</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>