Disable Attachments (Data Management)

Summary

Disables attachments on a geodatabase feature class or table. The tool deletes the attachment relationship class and attachment table.

Usage

  • If the input dataset is from an enterprise geodatabase, it must be from a database connection established as the data owner.

  • This tool permanently deletes all attachments internally stored in the geodatabase and associated with the Input Dataset. If attachments are enabled after being disabled, no attachments that were previously associated with the feature class or table will be present.

  • If the geodatabase feature class or table does not have attachments enabled, a warning message will appear and no processing will occur.

Parameters

LabelExplanationData Type
Input Dataset

The geodatabase table or feature class for which attachments will be disabled. The input must be in a version 10 or later geodatabase.

Table View

Derived Output

LabelExplanationData Type
Updated Input Dataset

The updated input dataset.

Table View

arcpy.management.DisableAttachments(in_dataset)
NameExplanationData Type
in_dataset

The geodatabase table or feature class for which attachments will be disabled. The input must be in a version 10 or later geodatabase.

Table View

Derived Output

NameExplanationData Type
out_dataset

The updated input dataset.

Table View

Code sample

DisableAttachments example (Python window)

The following code snippet illustrates how to use the DisableAttachments tool in the Python window.

import arcpy
arcpy.DisableAttachments_management(r"C:\Data\City.gdb\Parcels")
DisableAttachments example (stand-alone script)

The following script illustrates how to use the DisableAttachments tool in a stand-alone script.

# Name: DisableAttachments_Example.py
# Description: GDB Attachments are no longer required, so disable
#              attachments on the input dataset

# Import system modules
import arcpy

# Set the geoprocessing workspace to the feature dataset LandRecord
# in the geodatabase City.gdb
arcpy.env.workspace = r"C:\Data\City.gdb\LandRecord"

# Set local variables
input = "Parcels"

# Use DisableAttachments to delete all attachment files from the gdb
# and disable attachment handling
arcpy.DisableAttachments_management(input)

Environments