Enable Archiving (Data Management)

Summary

Enables archiving on a table, feature class, or feature dataset.

Usage

  • Enabling archiving provides the functionality to record and access changes made to a dataset over time.

  • The input dataset must be from a database connection established as the data owner.

  • Archiving can be enabled on versioned or nonversioned data.

Parameters

LabelExplanationData Type
Input Dataset

The name of the dataset on which archiving will be enabled.

Table; Feature Class; Feature Dataset

Derived Output

LabelExplanationData Type
Updated Dataset

The updated input dataset.

Table; Feature Class; Feature Dataset

arcpy.management.EnableArchiving(in_dataset)
NameExplanationData Type
in_dataset

The name of the dataset on which archiving will be enabled.

Table; Feature Class; Feature Dataset

Derived Output

NameExplanationData Type
out_dataset

The updated input dataset.

Table; Feature Class; Feature Dataset

Code sample

EnableArchiving example 1 (Python window)

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

arcpy.EnableArchiving_management("Database Connections//toolbox.county.parcels")
EnableArchiving example 2 (stand-alone script)

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

# Name: EnableArchiving_Example.py
# Description: Enable archiving on a dataset

# Import system modules
import arcpy

# Set local variables
in_dataset = 'C:/Data/connections/Redlands.sde/TEST.TOOLBOX.rdlsstreets'

# Describe the properties of the dataset to see if archiving is enabled.
desc = arcpy.Describe(in_dataset)
isArch = desc.IsArchived

# Enable Archiving if it is not already enabled.
if isArch == False:
    # Execute EnableArchiving
    arcpy.EnableArchiving_management(in_dataset)
    print("{0} has been enabled for archiving.".format(in_dataset))
elif isArch == True:
    # If IsArch = True, then archiving is already enabled
    print("{0} already has archiving enabled.".format(in_dataset))

Environments

Related topics