Imports attribute rules from a comma-separated values (.csv) file into a dataset.
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.
Columns Description Example
The name of the rule.
The description that was provided for the rule.
Operating pressure must be less than 300.
The type of attribute rule.
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.
If applicable, the name of the field the rule is applied to.
A Boolean value that defines whether the attribute field is editable or not.
A Boolean value that defines whether the triggering events for the rule are set for insert edits or not.
A Boolean value that defines whether the triggering events for the rule are set for delete edits or not.
A Boolean value that defines whether the triggering events for the rule are set for update edits or not.
The Arcade script expression that defines the rule.
$feature.OPERATINGPRESSURE < 300
If applicable, the error number for the rule.
If applicable, the error message for the rule.
Invalid operating pressure. Must be less than 300.
A Boolean value that defines whether the rule will be supported for all clients or simple clients.
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.
ImportAttributeRules_management (target_table, csv_file)
The table or feature class that will have the attribute rules applied. The dataset must have all features specified in the rule definition.
The .csv file containing the rules to import.
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")
- ArcGIS Desktop Basic: No
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes