Add Rule To Relationship Class (Data Management)

Summary

Adds a rule to a relationship class.

A relationship class is created with one-to-one, one-to-many, or many-to-many cardinality. A relationship class can be defined in more restrictive terms by adding a rule to a relationship class. Once a rule is added to a relationship class, that rule becomes the only valid relationship that can exist. To make other relationship combinations and cardinalities valid, additional relationship rules must be added.

Learn more about relationship rules

Usage

  • If the relationship class is stored in an enterprise geodatabase, this tool can only be successfully run by the data owner.

Parameters

LabelExplanationData Type
Input Relationship Class

The relationship class to which a rule will be added.

Relationship Class
Origin Subtype
(Optional)

Specifies the subtype of the origin class. If the origin class has subtypes, choose the subtype to which you want to associate a relationship class rule. If the origin class has no subtypes, the relationship rule will apply to all features.

String
Origin Minimum
(Optional)

Specifies the minimum range cardinality for the origin class if the relationship class is many-to-many.

Long
Origin Maximum
(Optional)

Specifies the maximum range cardinality for the origin class if the relationship class is many-to-many or one-to-many.

Long
Destination Subtype
(Optional)

Specifies the subtype of the destination class. If the destination class has subtypes, choose the subtype to which you want to associate a relationship class rule. If the destination class has no subtypes, the relationship rule will apply to all features.

String
Destination Minimum
(Optional)

Specifies the minimum range cardinality for the destination class if the relationship class is many-to-many or one-to-many.

Long
Destination Maximum
(Optional)

Specifies the maximum range cardinality for the destination class if the relationship class is many-to-many or one-to-many.

Long

Derived Output

LabelExplanationData Type
Updated Relationship Class

The updated relationship class with the relationship rule added.

Relationship Class

arcpy.management.AddRuleToRelationshipClass(in_rel_class, {origin_subtype}, {origin_minimum}, {origin_maximum}, {destination_subtype}, {destination_minimum}, {destination_maximum})
NameExplanationData Type
in_rel_class

The relationship class to which a rule will be added.

Relationship Class
origin_subtype
(Optional)

Specifies the subtype of the origin class. If the origin class has subtypes, choose the subtype to which you want to associate a relationship class rule. If the origin class has no subtypes, the relationship rule will apply to all features.

String
origin_minimum
(Optional)

Specifies the minimum range cardinality for the origin class if the relationship class is many-to-many.

Long
origin_maximum
(Optional)

Specifies the maximum range cardinality for the origin class if the relationship class is many-to-many or one-to-many.

Long
destination_subtype
(Optional)

Specifies the subtype of the destination class. If the destination class has subtypes, choose the subtype to which you want to associate a relationship class rule. If the destination class has no subtypes, the relationship rule will apply to all features.

String
destination_minimum
(Optional)

Specifies the minimum range cardinality for the destination class if the relationship class is many-to-many or one-to-many.

Long
destination_maximum
(Optional)

Specifies the maximum range cardinality for the destination class if the relationship class is many-to-many or one-to-many.

Long

Derived Output

NameExplanationData Type
out_rel_class

The updated relationship class with the relationship rule added.

Relationship Class

Code sample

AddRuleToRelationshipClass example (Python window)

The following Python window script demonstrates how to use the AddRuleToRelationshipClass function.

import arcpy

arcpy.management.AddRuleToRelationshipClass(
    "C:\\MyProject\\sdeConn.sde\\progdb.user1.ParcelsToBuildings", "Residential", 
    0, 1, "House", 1, 3)

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics