Open knoopum opened 6 months ago
@knoopum So what is happening in the insert layer method is that the file geodatabase gets added as an item and then published as an hosted feature item into your org. That is why when it fails you are left with that service.
The goal is to take the hosted feature layer and append it to your empty service and then remove that hosted service so you are left with the correct result.
What seems to be happening in the code is that when the analyze
function is called it thinks your data is a csv for some reason. This is a bug on our end and we will put in a fix for it.
A possible workaround would be using the insert_layer method associated with the spatially enabled dataframe or to try a different file type...
Thanks for reporting
@knoopum When I try to publish the file geodatabase it is empty. Just FYI since you said it has one point:
@nanaeaubry correct, the feature class in file geodatabase is empty. I was trying to say that the file geodatabase contains a single feature class, which is of type point, rather than one point's worth of data in the feature class :)
@knoopum Ok cool I didn't read that correctly my bad :) But we put in a small fix for the insert layer but the error remains and I wonder if it's because the file geodatabase is empty? When I try with a fgdb that has data in the same workflow as above (create empty feature service first), I don't get the error. I will look into it more and report any updates but seems it is an error that Online is sending back even though everything seems to have been created correctly.
@knoopum is this on online or enterprise? If enterprise, what version?
@achapkowski this is ArcGIS Online
@knoopum so it's not a Python API issue, it's actually an AGO Rest issue. We can get the same behavior from the GUI. Can you please open a support case?
@achapkowski to verify for the support case, what is the error I should be reporting for AGO?
If I use the zipped file geodatabase attached to this thread, and go to my Content --> New item --> uploaded the zip file from my computer --> change the File type to File geodatabase --> add and create hosted feature layer, then I do not observe an error in the GUI. The end result is as expected, a hosted feature layer containing a point layer, and the latter has the desired fields, editor tracking and attachments enabled, and no data, as expected.
@knoopum
In the GUI you add the filegeodatabase and it gets published. In the Python API you create an empty service first and then insert the data.
If you want to do the same as the GUI in the Python API you can do a content.add(...)
call and then publish the item. This could avoid the error occurring from inserting the empty layer.
I have successfully created an empty feature service with create_empty_service(). When attempting to add a layer to it with insert_layer, using a file geodatabase containing a single point feature class, it returns "Exception: Unknown Error (Error Code: 500)".
Inspecting the uploaded File Geodatabase and its resulting feature layer (hosted), they both look fine. And, when I examine the empty feature service, it does now have the expected layer in it. If I add it to map and add some points, it appears to be behaving correctly.
So I'm wondering what the error is about, and wether I should trust the feature service is correctly functional.
I've attached a zipped Notebook and File Geodatabase which can be used to reproduce the issue:
This is with ArcGIS API for Python version: 2.2.0.1