Copy FC With Attachments With Python or ModelBuilder

397
4
01-21-2018 06:42 AM
JoseSanchez
Occasional Contributor III

Hello everyone,

How do you copy FCs with attachments from one geodatabase to another? ArcCatalog works fine but can it be done in ModelBuilder or Python?

With ArcCatalog when the feature has a related table with attachments it copies everything together. But in Python or ModelBuilder what command do I use?

Thanks,

0 Kudos
4 Replies
Asrujit_SenGupta
MVP Regular Contributor
JoseSanchez
Occasional Contributor III

We are using ArcGIS 10.4.1

0 Kudos
Asrujit_SenGupta
MVP Regular Contributor

Maintain Attachments is not available at 10.4.x...so did you try to export to an XML workspace document and then import that in the other gdb? Will that work?

0 Kudos
JoseSanchez
Occasional Contributor III

Hi,

I haven't tested the option of exporting to an XML workspace.

What we need is to be able to work at the feature level. We have a feature class with attachments and we run a python script that archives records in anther feature created for this purpose.

The job currently selects features from the main feature class, and copies them to the archive FC, then deletes these same features from the main FC.

This is what we need for each feature candidate to be archived:

  • append a feature in FC archive,  with corresponding attachment.
  • remove feature to from FC main FC its attachments

 I am thinking about modifying this script https://community.esri.com/thread/82988

  • To add a new feature:
    • Append feature in FC archive
    • Find records in attached table from FC main
    • Append record in attached table from FC archive
    • update REL_OBJECTID with corresponding FC Archive OBJECTID
  • To remove feature from FC main
    • remove related attachment records
    • remove features
0 Kudos