I'm trying to increase the performance of a script we run to download all images from selected records in a hosted feature layer and save them down with specific naming formatting. We've been doing this by exporting the hosted feature layer to a local geodatabase and following the rest of the process. But the time to process keeps increasing exponentially when accessing these intermediate steps from the local geodatabase.
I'm trying to get these intermediate steps to all run in memory until saving the final photos down to our network server. I can easily get the input_layer to memory and added to the map. But it doesn't come with any of its attachments and I can't find a way to save the attachments table as well. Any thoughts?
p = arcpy.mp.ArcGISProject("CURRENT")
m = p.listMaps()[0]
tempExportFeatureClass = arcpy.conversion.ExportFeatures(<input_layer>, r"memory\TempExport")
tempExportFeatureClass_object = arcpy.management.MakeFeatureLayer(tempExportFeatureClass, "TempExport_lyr")
TempExport_lyr = tempExportFeatureClass_object.getOutput(0)
m.addLayer(TempExport_lyr)