You can create relationship classes between any feature class or table in a geodatabase using the Create Relationship Class or Table to Relationship Class geoprocessing tools in ArcGIS Pro. You can use these tools to create simple, composite, and attributed relationship classes.
In a composite relationship class, the child records are dependent on the parent records. If a parent record is deleted, all related child records are also deleted.
For example, in a composite relationship class, a building footprint (parent record) can have multiple floors (child records). If the building footprint is deleted, the floors that are associated with the building footprint are also deleted, as they don't exist independently.
Before getting started with the steps below, see Prepare to create a relationship class to review the data requirements.
Note:
Relationship classes are supported in file, mobile, and enterprise geodatabases. To create a relationship class, you can right-click an existing geodatabase or a feature dataset in a geodatabase. If you're creating a relationship class in an enterprise geodatabase, you must connect to the enterprise geodatabase as a user with privileges to create data in the database.
To create a composite relationship class, complete the following steps:
- Start ArcGIS Pro and open an existing project, or begin without a template.
- In the Catalog pane, right-click an existing geodatabase and click New from the context menu.
- Click Relationship Class .
The Create Relationship Class geoprocessing tool dialog box appears with default settings.
- For the Origin Table parameter, you can choose a dataset from the list, or use the browse button to find a dataset.
- For the Destination Table parameter, you can choose a dataset from the list, or use the browse button to find a dataset.
- For the Output Relationship Class parameter, click the browse button , browse to the geodatabase where the relationship class will be stored, provide a name for the relationship class in the Name text box, and click Save.
For this example, the origin and destination tables are located in a mobile geodatabase named Wyoming Natural Assets.geodatabase. The relationship class must also reside in this mobile geodatabase. Since the mobile geodatabase is built on top of SQLite, the main prefix is automatically added to the relationship class name to indicate that it belongs to the main schema, which is the default schema for a SQLitedatabase.
The name of the relationship class is reflected in the Output Relationship Class parameter.
- For the Relationship Type parameter, choose Composite from the drop-down list.
To learn more about the differences between the simple and composite relationship class types, see Geodatabase relationship class types.
- Provide values for the Forward Path Label and Backward Path label parameters.
The forward path label describes the relationship as it is navigated from the origin class to the destination class, and the backward path label describes the relationship when navigated in the opposite direction, from the destination class to the origin. See Create Relationship Class tool parameters to learn more about these labels.
- Since you are creating a composite relationship class, for the Message Direction parameter, choose Forward (origin to destination).
The Message Direction parameter specifies how messages are passed between related objects. This parameter is applicable if you want to implement custom cascade update or delete behaviors for the relationship class. See Create Relationship Class tool parameters to learn more about the different effects of setting the Message Direction parameter for a simple or a composite relationship class.
- For the Cardinality parameter, choose the cardinality option that is appropriate for the data in the relationship class.
The cardinality for a relationship class describes how many objects in the origin are related to how many objects in the destination. The following are the Cardinality parameter options:
- One to one (1:1)—Each row or feature in the origin table can be related to zero or one row or feature in the destination table. This is the default setting.
- One to many (1:M)—Each row or feature in the origin table can be related to one or more rows or features in the destination table.
- Many to many (M:N)—Multiple rows or features in the origin table can be related to multiple rows or features in the destination table.
- Optionally, check the Relationship class is attributed parameter (or leave it unchecked) to specify whether the relationship class will have attributes.
- Unchecked—The relationship class will not have attributes. This is the default.
- Checked—An attributed relationship class will be created. When a many to many (M:N) or attributed relationship class is created, a new intermediate relationship class table is created. This table is used to map the associations between the origin and destination objects. See Geodatabase relationship class types to learn more about attributed relationship classes.
- For the Origin Primary Key and Origin Foreign Key parameters, specify a field from the origin table and a field from the destination table, respectively..
The Origin Primary Key and Origin Foreign Key parameters specify the primary key in the origin feature class and the associated foreign key field in the destination table. For the Origin Foreign Key parameter, only the fields that are the same data type as the field specified for the Origin Primary Key parameter are displayed.
- Click Run to create the relationship class.
Note:
You can click the Run drop-down menu and click Schedule Run to run the tool at a later date and time and, optionally, with recurrence.