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.

  • Attribute rules are only supported on enterprise geodatabase datasets.

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

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

    .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

  • 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

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

  • ArcGIS Desktop Basic: No
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics