Detect Relationship in Feature Class or Table

Discussion created by stsnider on Aug 9, 2012
Latest reply on Nov 21, 2013 by bangel
ArcGIS Desktop 10.0

I have a script that copies feature classes and tables from one workspace to another on a schedule.  It is a backup script.  My problem is that when I try to copy a feature class that has a relationship class with a table, the copy fails - because the table that is associated with the feature class by a relationship also tries to be copied and that table already exists.  I would like to have a way to detect if a feature class is in a relationship, and what other featureclasses or tables it shares that relationship with.  I tried the following on a feature class that I know has a relationship, but the result came back empty.

>>> desc = arcpy.Describe(r'Database Connections\BWQP_NDEP24.sde\BWQP.AssessedStreams2010')
>>> desc
<geoprocessing describe data object object at 0x1E829440>
>>> print "%-22s %s" % ("RelationshipClassNames:", desc.relationshipClassNames)
RelationshipClassNames: []

I'm able to list the relationship classes, but I can't describe them enough to see the feature classes and tables associated with them.
>>> rc_list = [ for c in arcpy.Describe(workspace).children if c.datatype == "RelationshipClass"]
>>> rc_list
[u'BWQP.Lakes_to_TMDL', u'BWQP.Lakes_to_Waterbody', u'BWQP.Rivers_to_TMDL', u'BWQP.Rivers_to_Waterbody', u'BWQP.AssessedLakes_to_IR10', u'BWQP.AssessedStreams_to_IR10']

I also read that there is a bug NIM048192 with python in that it does not have access to the key relationship class properties.