Hi Mappers,
I've written a script that periodically overwrites the feature classes housed on our server with feature layers from our ArcGIS Online account. It works well except with one of the layers titled CustomerEndpoint. I get this warning:
This geodatabase does not support this client or operation [This geodatabase does not support this client or operation [This geodatabase does not support this client or operation][CustomerEndpoint.objectid_12]]
The resulting feature class is missing several fields, and the ObjectID and GlobalID fields have different names than those on our AGOL account (no features seems to be missing though). It's obvious that there is an issue with the unique ID fields but I don't know what that issue is.
Any brainy mappy thoughts/suggestions would be appreciated.
Script below with any sensitive info edited out...
def backup_weblayers_to_server():
## info for logging doc
logging.basicConfig(filename='update_log.log', level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s')
## connect to AGOL
gis = GIS('home')
## filepath to server db connection
DB_CONNECTION = filepath to db connection
## item IDs for each web layer to be backed up
D_VALVES_ID = agol item id
ENDPOINT_ID = agol item id
D_LINE_ID = agol item id
T_LINE_ID = agol item id
T_VALVES_ID = agol item id
S_LINES_ID = agol item id
IDS = [D_VALVES_ID, ENDPOINT_ID, D_LINE_ID, T_LINE_ID, T_VALVES_ID, S_LINES_ID]
for id in IDS:
msg = f"Accessing web layer..."
print(msg)
logging.info(msg)
item = gis.content.get(id) # AGOL item
msg =f"Converting {item.title} web layer to feature set..."
print(msg)
logging.info(msg)
feat_set = item.layers[0].query(as_df = True) # feature set of web layer
msg = f"{item.title} feature set contains {len(feat_set)} records."
print(msg)
logging.info(msg)
# # establish dataset in which to save feature set
if "Transmission" in item.title:
dataset = 'Transmission_Dataset'
elif item.title == 'Distribution Valves':
dataset = 'Distribution_Assets'
else:
dataset = 'Distribution_Network'
# clean up title to be used for feature class name
fc_name = item.title.replace(" ","_")
# complete file path where to save the feature class
location = os.path.join(DB_CONNECTION,dataset, fc_name)
msg = f"Overwriting {fc_name} feature class on server..."
print(msg)
logging.info(msg)
try:
# convert feature set to a spatially enabled dataframe
# and save it as a feature class in the db on the server
feat_set.spatial.to_featureclass(location = location, overwrite=True)
msg = f"{item.title} successfully backed up on server. Path: {os.path.join(dataset, fc_name)}\n"
print(msg)
logging.info(msg)
except Exception as e:
msg = f"{item.title} not able to be backed up. Moving to next layer See Exception below:\n{e}"
print(msg)
logging.info(msg)
continue
return
backup_weblayers_to_server()
Having the same issue. Something about data types. Have you found a solution yet?? Would be very helpful!