How do I delete a relationship class in python
Solved! Go to Solution.
What about something simple like this:
import arcpy
# Local variables:
data_to_delete = "C:\\a.gdb\\t3meta"
Delete_succeeded = "false"
# Process: Delete
arcpy.Delete_management(data_to_delete, "RelationshipClass")
I can create one like this but how do I delete one.
import arcpy
from arcpy import env
env.workspace = "C:\a.gdb"
origin_table = "Trail_meta"
destination_table = "trails_mfg"
out_relationship_class = "t3meta"
relationship_type = "SIMPLE"
forward_label = "Attributes from meta"
backward_label = "Attributes from trail"
message_direction = "NONE"
cardinality = "ONE_TO_MANY"
attributed = "NONE"
origin_primary_key = "OBJECTID"
origin_foreign_key = "TRAIL_NAME"
arcpy.CreateRelationshipClass_management(origin_table,
destination_table,
out_relationship_class,
forward_label,
backward_label,
message_direction,
cardinality,
attributed,
origin_primary_key,
origin_foreign_key)
You should be able to use Delete—Help | ArcGIS for Desktop. The documentation specifically mentions relationship classes: "Deleting a relationship class deletes the row corresponding to that relationship from the relationship table."
What about something simple like this:
import arcpy
# Local variables:
data_to_delete = "C:\\a.gdb\\t3meta"
Delete_succeeded = "false"
# Process: Delete
arcpy.Delete_management(data_to_delete, "RelationshipClass")