Import Attribute Rules (Data Management)

Summary

Imports attribute rules from a comma-separated values file (.csv) to a dataset.

Usage

    Note:

    Once you import attribute rules to a dataset, the minimum client version for the dataset is ArcGIS Pro 2.1. This means that the dataset will no longer be available for use in ArcGIS Desktop.

  • This tool will only import rules that do not already exist for the dataset, it will not update existing rules. The uniqueness of a rule applied to a dataset is determined by the rule name, not the rule definition. For example, a feature class has two rules named Rule A and Rule B. If the input .csv file attempts to import rules named Rule B and Rule C, Rule C will be imported, but Rule B will not since a rule named Rule B already exists for the dataset.

    If a failure is encountered during import, the specific column and row that failed are indicated in an error message. The remaining valid attribute rules in the .csv file will be imported.

  • This tool can be used in conjunction with the Export Attribute Rules tool.

  • Rules created using ArcGIS Data Reviewer tools require a Data Reviewer extension license to import. A warning is returned when the imported .csv file contains a Data Reviewer-based rule and a Data Reviewer extension license is not available.

    If a warning is encountered during import, the specific row that failed is indicated in a warning message. The remaining valid attribute rules in the .csv file will be imported.

  • Note:

    Exporting attribute rules from an ArcGIS Pro 3.4 or later client will include the TRIGGERINGFIELDS column in the .csv. To import attribute rules using an earlier version of ArcGIS Pro ensure this column is removed from the .csv before importing.

    The imported .csv must contain the following columns:

    ColumnDescriptionExample

    NAME

    The name of the rule.

    constraintRuleOP

    DESCRIPTION

    The rule description.

    Operating pressure must be less than 300.

    TYPE

    The type of attribute rule.

    CONSTRAINT, CALCULATION

    SUBTYPE

    If the dataset has a subtype and the subtype is used in the rule definition, this is the subtype name (also known as description) to which the rule is applied.

    ALL

    FIELD

    The name of the field to which the rule is applied, if applicable.

    CONDITION

    ISEDITABLE

    A Boolean value that defines whether the attribute field is editable.

    True or False

    TRIGGERINSERT

    A Boolean value that defines whether the triggering events for the rule are set for insert edits.

    True or False

    TRIGGERDELETE

    A Boolean value that defines whether the triggering events for the rule are set for delete edits.

    True or False

    TRIGGERUPDATE

    A Boolean value that defines whether the triggering events for the rule are set for update edits.

    True or False

    SCRIPTEXPRESSION

    The ArcGIS Arcade script expression that defines the rule.

    $feature.OPERATINGPRESSURE < 300

    ERRORNUMBER

    The error number for the rule, if applicable.

    99

    ERRORMESSAGE

    The error message for the rule, if applicable.

    Invalid operating pressure. The value must be less than 300.

    EXCLUDECLIENTEVALUATION

    A Boolean value that defines whether the rule is supported for all clients or simple clients.

    True or False

    ISENABLED

    A Boolean value that defines whether the attribute rule is enabled.

    True or False

    BATCH

    A Boolean value that defines whether the rule supports batch validation.

    True or False

    SEVERITY

    An integer value (1–5) that defines the severity of the error.

    2

    TAGS

    A set of string values that identify the rule.

    Operating pressure

    CATEGORY

    A system-generated integer value that defines the rule category, if applicable.

    This value is system generated and should not be modified.

    6

    CHECKPARAMETERS

    A system-generated JSON value that defines the configuration of a Data Reviewer-based rule.

    This value is system generated and should not be modified.

    {"ReviewerRuleType": "0", "minimumangle": "60"}

    TRIGGERINGFIELDS

    A list of field values representing the fields where an edit occurs that will trigger the attribute rule.

    Note:
    An empty array defined as [] represents all fields as triggering fields. When no triggering fields are specified, all fields are listed as triggering fields.

    ["RoadCondition", "NumberOfLanes", "RoadType"]

Parameters

LabelExplanationData Type
Target Table

The table or feature class to which the attribute rules will be applied. The dataset must have all the features specified in the rule definition.

Table View
Input File

The .csv file containing the rules to import.

File

Derived Output

LabelExplanationData Type
Attribute Rules Imported

The updated input dataset.

Table View; Raster Layer; Mosaic Layer

arcpy.management.ImportAttributeRules(target_table, csv_file)
NameExplanationData Type
target_table

The table or feature class to which the attribute rules will be applied. The dataset must have all the features specified in the rule definition.

Table View
csv_file

The .csv file containing the rules to import.

File

Derived Output

NameExplanationData Type
out_table

The updated input dataset.

Table View; Raster Layer; Mosaic Layer

Code sample

ImportAttributeRules example (Python window)

Import attribute rules from a .csv file to a feature class named Building.

import arcpy
arcpy.management.ImportAttributeRules("C:\\MyProject\\MyDatabase.sde\\pro.USER1.Building",
                                      "C:\\MyProject\\expAttrRules.csv")

Environments

Related topics