Hi I am attempting to export a hosted feature server to a FGDB for later download but running into errors.
KeyError Traceback (most recent call last) <ipython-input-34-c3c8826240dd> in <module> 21 print (exportName) 22 ---> 23 data_item.export(exportName, "File Geodatabase") /opt/conda/lib/python3.7/site-packages/arcgis/gis/__init__.py in export(self, title, export_format, parameters, wait, enforce_fld_vis, tags, snippet, overwrite) 8776 params['exportParameters'] = {"enforceFieldVisibility" : enforce_fld_vis } 8777 res = self._portal.con.post(data_path, params) -> 8778 export_item = Item(gis=self._gis, itemid=res['exportItemId']) 8779 if wait == True: 8780 status = "partial" KeyError: 'exportItemId'
The code runs fine on a simple hosted service, but fails with error above when run on a feature server with multiple service layers and tables.
#import modules
from arcgis.gis import GIS
from arcgis.features import manage_data
import time, os, fnmatch, shutil
from pathlib import Path
#gis = GIS(username="Username", password="Password")
gis = GIS("home")
item_id = '564d5e1840b44ab1b6f4083cfaaf7928'
#item_id = '22b8d8af9b0842ffa622a73655946146'
data_item = gis.content.get(item_id)
data_item.title
itemName = gis.content.get(item_id).title
fgdb_title = itemName
t = time.localtime()
timestamp = time.strftime('%b%Y',t)
exportName = "{}_Download{}".format(itemName, timestamp)
print (exportName)
data_item.export(exportName, "File Geodatabase")
Solved! Go to Solution.
This is resolved. My fault: I had using AdminTools to "copy" the complex feature service in question but it didn't actually copy everything and the "export" option simply unavailable on that particular item. The Notebook appears to run successfully on a valid item.
This is resolved. My fault: I had using AdminTools to "copy" the complex feature service in question but it didn't actually copy everything and the "export" option simply unavailable on that particular item. The Notebook appears to run successfully on a valid item.