I have been working on exporting attachments from a point feature class by location (County). The export is renamed by the area (County), which contains the feature class, attachment table, and the relationship class, using this:
import arcpy, os, datetime, traceback, sys
Start = datetime.datetime.now()
print ('Running Elevation Certificate by County Export ' + str(datetime.datetime.now()))
arcpy.env.maintainAttachments = True
DOMAIN_COUNTIES_TABLE = r"S:\Projects\CFI_Models\USNG_Demographics_Statewide\Domain_Counties.gdb\DOMAIN_COUNTIES"
DOMAIN_COUNTIES_Descript = "Descript"
DOMAIN_COUNTIES_CURSOR = arcpy.SearchCursor(DOMAIN_COUNTIES_TABLE)
for row in DOMAIN_COUNTIES_CURSOR:
COUNTIES_DESCRIPT = row.getValue(DOMAIN_COUNTIES_Descript)
infc = "T:\Projects\Elevation_Certificates\ECs_Hosted_20200929.gdb\ELEVATION_CERTIFICATES"
outgdb = "T:\Projects\Elevation_Certificates\ECs_Archive_by_County.gdb"
where_clause = "\"COUNTY_COMMUNITY\" = '%s' " %COUNTIES_DESCRIPT
print ("Exporting: " + '%s' %COUNTIES_DESCRIPT)
StartTime = datetime.datetime.now()
arcpy.FeatureClassToFeatureClass_conversion(infc, outgdb, "%s" %COUNTIES_DESCRIPT, where_clause)
EndTime = datetime.datetime.now()
DeltaTime = EndTime - StartTime
TimeDiff = str(DeltaTime)
print ('Process Time: ' + TimeDiff)
print ('Completed County Feature Class Export ' + str(datetime.datetime.now()))
End = datetime.datetime.now()
Delta = End - Start
Time = str(Delta)
print ('Process Time: ' + Time)
This yields everything I need but loses the relationship. Any ideas how to rebuild this relationship or how to successfully export the data that carries the relationship class?
Thanks,
Daniel