Select to view content in your preferred language

Syncing AGOL Attachments with DB

497
4
Jump to solution
10-21-2024 09:10 AM
CodyPatterson
Frequent Contributor

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

0 Kudos
1 Solution

Accepted Solutions
MErikReedAugusta
Frequent Contributor

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.

View solution in original post

4 Replies
MErikReedAugusta
Frequent Contributor

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.

RobertKrisher
Esri Regular Contributor

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.

0 Kudos
RhettZufelt
MVP Notable Contributor

For this, I use arcpy.append with Maintain Attachments = True.

R_

0 Kudos
AndresCastillo
MVP Regular Contributor

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:

AndresCastillo_0-1733385113975.jpeg

 

The export will create the relationship class with all the needed pictures assigned to the respective records.

AndresCastillo_1-1733385240535.png

 

 

AndresCastillo_2-1733385327880.png

 

0 Kudos