Skip To Content

Disable Attribute Rules

Summary

Disables one or more attribute rules from 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.

  • Attribute rules are only supported on enterprise geodatabase datasets.

  • 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_management (in_table, names, {type})
ParameterExplanationData Type
in_table

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

Table View
names
[names,...]

The names of the rules to disable on the dataset.

String
type
(Optional)

Specifies the type of attribute rules to disable. When a rule type is specified, the tool will verify that the type of rule specified in this parameter matches the rule type of the rule specified. If they do not match, the rule will not be disabled.

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

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

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

Related topics