Skip To Content

Disable Attribute Rules

Summary

Disables one or more attribute rules for a dataset.

Usage

  • If you've applied attribute rules to your data and are loading larges amount of data, you can use this tool to disable one or more rules to avoid potential performance issues.

  • You can use the Enable Attribute Rules tool to re-enable rules when applicable.

  • All new attribute rules (whether created individually or imported) are enabled by default. This tool allows you to disable the rule logic until you are ready to enforce it.

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

Syntax

DisableAttributeRules(in_table, names, {type})
ParameterExplanationData Type
in_table

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

Table View
names
[names,...]

The names of the rules to disable for the dataset.

String
type
(Optional)

Specifies the type of attribute rules to disable. 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 disabled.

  • CALCULATIONDisable a calculation rule.
  • CONSTRAINTDisable a constraint rule.
  • VALIDATIONDisable a validation rule.
String

Derived Output

NameExplanationData Type
out_table

The updated input table with one or more attribute rules disabled.

Table View; Raster Layer; Mosaic Layer

Code sample

DisableAttributeRules example 1 (Python window)

Disable two specific calculation attribute rules from a feature class.

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

Disable calculation and constraint attribute rules from a feature class.

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

Use arcpy.Describe to disable all constraint rules that are currently enabled.

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

Environments

Licensing information

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

Related topics