Skip To Content

Import Attribute Rules

Summary

Imports attribute rules from a comma-separated values (.csv) file into 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.

  • The dataset must reside in an enterprise geodatabase.

  • 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 description that was provided for the rule.

    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 will be the subtype name that the rule is applied to.

    ALL

    FIELD

    If applicable, the name of the field the rule is applied to.

    CONDITION

    ISEDITABLE

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

    True, False

    TRIGGERINSERT

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

    True, False

    TRIGGERDELETE

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

    True, False

    TRIGGERUPDATE

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

    True, False

    SCRIPTEXPRESSION

    The Arcade script expression that defines the rule.

    $feature.OPERATINGPRESSURE < 300

    ERRORNUMBER

    If applicable, the error number for the rule.

    99

    ERRORMESSAGE

    If applicable, the error message for the rule.

    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, False

    ISENABLED

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

    True, False

    BATCH

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

    True, False

    SEVERITY

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

    2

    TAGS

    A set of string values to identify the rule.

    Operating pressure

    CATEGORY

    If applicable, a system generated integer value that defines the rule category.

    This value is system generated and should not be modified

    6

    CHECKPARAMETERS

    If applicable, 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.

Syntax

ImportAttributeRules_management (target_table, csv_file)
ParameterExplanationData Type
target_table

The table or feature class that will have the attribute rules applied. The dataset must have all 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 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\\expAttrRules.csv", 
                                      "C:\\MyProject\\MyDatabase.sde\\pro.USER1.Building")

Environments

Licensing information

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

Related topics