Import Attribute Rules (Data Management)

Summary

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

Usage

  • 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 are 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 are imported.

  • The .csv file includes the following columns: NAME, DESCRIPTION, TYPE, SUBTYPE, FIELD, ISEDITABLE, TRIGGERINSERT, TRIGGERDELETE, TRIGGERUPDATE, SCRIPTEXPRESSION, ERRORNUMBER, ERRORMESSAGE, EXCLUDECLIENTEVALUATION, ISENABLED, BATCH, SEVERITY, TAGS, CATEGORY, and CHECKPARAMETERS.

    .csv columns

    ColumnsDescriptionExample

    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 subtypes and the subtype is used in the rule definition, this is the subtype name 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 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. Must be less than 300.

    EXCLUDECLIENTEVALUATION

    A Boolean value that defines whether the rule will be 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"}

  • 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.

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.ImportAttributeRules_management("C:\\MyProject\\MyDatabase.sde\\pro.USER1.Building",
                                      "C:\\MyProject\\expAttrRules.csv")

Environments

Licensing information

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

Related topics