Feature Layer won't update from File GeoDatabase using Overwrite API

176
1
07-28-2021 08:01 AM
CarrieQuast
New Contributor II

Hello - I need to automate a nightly update from one item in a File Geodatabase to overwrite a feature layer in ArcGIS Enterprise Portal.  I am using the code from this site almost exactly

I can connect to the my portal site, and something runs and the feature layer even gives an updated modified date, but I don't think its finding my File GeoDatabase correctly.

This is the code I'm using (note that identifying info has been changed)

 

import os
import arcgis
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection

orgURL = "https://my.website.com"
adminUserName = "administratoraccount"
orgPass = "password"

gis = GIS(orgURL, username=adminUserName, password=orgPass)

LOCgdb = "C:\PLSS_HARN.gdb"
LOCAL_Parcel = "Parcel_Tax"

Parcel_Online = gis.content.search("id:12233456678889911000")

FLC_Parcel_Online = FeatureLayerCollection.fromitem(Parcel_Online[0])

FLC_Parcel_Online.manager.publish.overwrite(os.path.join(LOCgdb, LOCAL_Parcel))

 

 

I can update the feature layer manually in Pro by overwriting the web layer just fine. 

What am I missing?

0 Kudos
1 Reply
emedina
New Contributor III

I'm surprised you don't mention an error.

One thing I would change immediately is how the path is written:

LOCgdb = r"C:\PLSS_HARN.gdb"

 

Also, what is the point of the search? It seems like you know what the item id is, unless that number means something else. It would be more direct to do:

item = gis.content.get("youritemid")

 

All that aside, I think the source of the problem is you're calling the wrong method. The last line should read:

FLC_Parcel_Online.manager.overwrite(os.path.join(LOCgdb, LOCAL_Parcel))

 

Hope this helps.

0 Kudos