Hey everyone,
I'm currently running the minor-release-gauntlet with my Python scripts. I've upgraded to Pro 3.3.0 from Pro 3.2.2 in my testing environment and am executing my Python scripts to ensure I haven't missed anything with deprecations since Python jumped from 3.9 to 3.11.
I've come across one scenario where it does appear that a feature has been deprecated, and I'm hoping to get some advice and/or clarification on what I should use instead.
In this scenario, my script has been uploading a Vector Tile Package to our ArcGIS Online account for a couple of years without issue. I do this by initiating an AGOL session in Python, then proceeding with agol_session.content.add() to upload the VTPK. Code snippet here:
# Attempts to add the VTPK file to AGOL, with parameters set.
upload_result = agol_session.content.add(
item_properties={"title": vtpk_name,
"description": "Description Text",
"snippet": "Snippet Text",
"tags": "OurAgencyName",
"overwrite": True},
data=vtpk_path, owner="OwnerName")
The upload is successful in Pro 3.3.0, but I now receive this warning message:
Attempting to re-run the script (and overwrite the previously uploaded VTPK) results in a new error:
The error makes sense, since 'overwrite' parameter has been deprecated. However, I have been unable to find any details about this deprecation. Confusingly, the current item_properties documentation for content.add() still show 'overwrite' as an option:
The overwrite parameter would overwrite the file uploaded to AGOL if the name/file already existed. We liked that feature (sometimes we need to re-run the content.add() workflow more than once a day if a quick replacement is needed for the same VTPK). The naming convention of the VTPK upload has been YYYYMMDD_AgencyName_BasemapAffiliatedName. I could start including HHMMSS to help keep the duplication from occurring, but I'd rather just use a parameter that accomplishes an overwrite if a new one was created.
Any thoughts or recommendations? Thanks!
Just encountered this as well, same workflow to update Vector Tiles, probably using the same code snippet provided by Esri. Fortunately I have an email delivered at the end of the script reporting on the success or failure of the scheduled task to update the Vector Tiles, so was able to capture this error.
I went in and modified the script to run an update on the layer tile package instead of an add with overwrite.
vtpk_properties = {
'title': 'LA County Basemap Source Vector Tiles - STAGED',
'description': 'Updated/staged version of LA County Base Map Vector Tiles',
'tags': 'Vector Tile'}
vtpk_item = gis.content.get(vtpkID)
vtpk_item.update(item_properties=vtpk_properties, data=vtpk)
Then do the publish and replace
vtpk_service_item = vtpk_item.publish()
print("VECTOR TILE PACKAGE:\nTitle: " + str(vtpk_item.title) + " ID: " + str(vtpk_item.id))
print("VECTOR TILE SERVICE:\nTitle: " + str(vtpk_service_item.title) + " ID: " + str(vtpk_service_item.id))
gis.content.replace_service(prodTileCacheID, vtpk_service_item.id)