Hey all,
I've found the need to sync an AGOL hosted feature layer with attachments to our local DB. I've pull the FGDB and loaded it onto the DB, and created a Python script using the ArcGIS API for Python, to sync the points and features, but I'm now lost for how I would bring the attachments over. I've found the documentation on how to actually access these through the API for Python, but I haven't found how to get these over.
I'm using SQL Server 2019, newest ArcGIS Pro, and I have access to ArcPy.
Any suggestions?
Thanks in advance!
Cody
Solved! Go to Solution.
Broadly speaking, you'll probably need to use the API to "download" the attachments into memory in a script, and then use Add Attachments to add them to the Feature Class in the DB.
If you need specific help, let me know, but I'm a little rusty on the API.
Broadly speaking, you'll probably need to use the API to "download" the attachments into memory in a script, and then use Add Attachments to add them to the Feature Class in the DB.
If you need specific help, let me know, but I'm a little rusty on the API.
There are also geoprocessing tools that allow you to bulk export and add attachments, these tools do respect selected features (even when run standalone) so you'll use layers to manage which attachments to export.
You can also do this using the ArcGIS API for Python to individual download and add attachments between the two environments.
For this, I use arcpy.append with Maintain Attachments = True.
R_
If you take the portal item layer url.
login to the portal and set it as active portal in pro.
bring in the layer using the item id.
export the features, enabling the environments (Maintain Attachments, and Preserve Global IDs) as below:
The export will create the relationship class with all the needed pictures assigned to the respective records.