I'm following this help doc. https://geosaurus.maps.arcgis.com/home/item.html?id=a1db6db172bc49a8932daacc2ed3d3ac#preview
I'm able to add the CSV to the Portal, but I cannot get it to publish. I need it published as a table. It doesn't have coordinate fields and it's not intended to be a spatial feature.
from IPython.display import display
from arcgis.gis import GIS
import os
gis = GIS('Home')
csv_file = r'C:\Users\jpilbeam\Downloads\c19_Vaccine_Current.csv'
csv_item = gis.content.add({}, csv_file)#add csv to Portal
csv_layer = csv_item.publish(None, file_type='csv')
Error:
--------------------------------------------------------------------------
KeyError Traceback (most recent call last)
In [15]:
Line 1: csv_layer = csv_item.publish(None, file_type='csv')
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py, in publish:
Line 10353: elif not buildInitialCache and ret[0]['type'].lower() == 'image service':
KeyError: 'type'
---------------------------------------------------------------------------
Other attempts:
csv_layer = csv_item.publish()
KeyError: 'type'
csv_layer = csv_item.publish('csv')
ValueError: dictionary update sequence element #0 has length 1; 2 is required
csv_layer = csv_item.publish(publishParameters={"type":"csv"})
TypeError: publish() got an unexpected keyword argument 'publishParameters'
I also tried what the help doc does. It has a text field with place name values specified in the address_fields
parameter. My CountyName field is also a text field with place names. But, this also errors.
csv_flayer = csv_item.publish(None, {"Address":"CountyName"})
KeyError: 'type'