Currently it is not possible to create a view from a hosted table using the ArcGIS Python API. This might be a very useful tool to allow multilanguage implementations without duplicating data in AGOL or Portal. This way, data maintenance and update tasks might be simplified.
This would be very welcome addition... or should I say fix. This would allow us actually use the view publishing through Python API. If someone knows a good workaround, I would be happy to hear.
This would enable us to create hosted feature layer views via the python API in the same way as we can using the web map Analysis / Summarize Data / Join Features tool. This is actually vital as we are unable to make any data model changes to layers that participate in views - the views must be deleted first and then recreated afterwards. This is a tedious and error-prone procedure that puts production web maps and web applications at risk. The ability to create hosted feature layer views via the python API would greatly improve this workflow.
You can create view on both tables and feature layers:
from arcgis.features import FeatureLayerCollection, FeatureCollection
gis = GIS(profile='<login profile>')
item = gis.content.get("<item id>") # Table or Feature Layer Item
fs = FeatureLayerCollection.fromitem(item)
view_item = fs.manager.create_view(name='<Item Name>', spatial_reference=None, extent=None, allow_schema_changes=True, updateable=True, capabilities='Query', view_layers=None, view_tables=None, description=None, tags=None, snippet=None, overwrite=None, set_item_id=None)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.