Enable Attribute Rules (Data Management)

Summary

Enables one or more attribute rules in a dataset

Usage

  • New attribute rules are enabled by default upon creation or import, but if you disabled them using the Disable Attribute Rules tool, you can use this tool to re-enable the rules so that they will be enforced again.

  • You can use this tool in conjunction with the Disable Attribute Rules tool to disable and re-enable rules as needed.

  • If you specify both a rule name and a rule type when running this tool, upon execution, the tool will verify that the type of rule specified matches the rule type specified. If they do not match, the rule will not be enabled.

Parameters

LabelExplanationData Type
Input Table

The table or feature class that contains the attribute rule to be enabled.

Table View
Rule Names

The names of the rules to enable for the dataset.

String
Type
(Optional)

Specifies the type of attribute rules to enable.

  • Calculation—Filters the Rule Names parameter to display only calculation type rules.
  • Constraint—Filters the Rule Names parameter to display only constraint type rules.
  • Validation—Filters the Rule Names parameter to display only validation type rules.

  • CalculationEnable a calculation rule.
  • ConstraintEnable a constraint rule.
  • ValidationEnable a validation rule.
String

Derived Output

LabelExplanationData Type
Output Feature Class

The updated input table with an attribute rule enabled.

Table View; Raster Layer; Mosaic Layer

arcpy.management.EnableAttributeRules(in_table, names, {type})
NameExplanationData Type
in_table

The table or feature class that contains the attribute rule to be enabled.

Table View
names
[names,...]

The names of the rules to enable for the dataset.

String
type
(Optional)

Specifies the type of attribute rules to enable. The tool will verify that the type of rule specified in this parameter matches the rule type specified. If they do not match, the rule will not be enabled.

  • CALCULATIONEnable a calculation rule.
  • CONSTRAINTEnable a constraint rule.
  • VALIDATIONEnable a validation rule.
String

Derived Output

NameExplanationData Type
out_table

The updated input table with an attribute rule enabled.

Table View; Raster Layer; Mosaic Layer

Code sample

EnableAttributeRules example 1 (Python window)

Enable two specific calculation attribute rules from a feature class.

import arcpy
arcpy.EnableAttributeRules_management("C:\\MyProject\\MyDatabase.sde\\pro.USER1.campusData", 
                                      "Rule A;Rule B", "CALCULATION")
EnableAttributeRules example 2 (Python window)

Enable calculation and constraint attribute rules from a feature class.

import arcpy
arcpy.EnableAttributeRules_management("C:\\MyProject\\MyDatabase.sde\\pro.USER1.campusData", 
                                      "Calculation Rule A;Constraint Rule A")
EnableAttributeRules example 3 (Python window)

Use arcpy.Describe to enable all constraint rules that are currently disabled.

import arcpy
fc = "C:\\MyProject\\MyDatabase.sde\\pro.USER1.campusData"
desc = arcpy.Describe(fc).attributeRules
for rule in desc:
    if rule.isEnabled == False and rule.type == "esriARTConstraint":
        print("Enabling rule: {}".format(rule.name))
        arcpy.EnableAttributeRules_management(fc, rule.name)

Environments

Related topics