Compact (Data Management)

License Level:BasicStandardAdvanced

Summary

Compacts a personal or file geodatabase. Compacting rearranges how the geodatabase is stored on disk, often reducing its size and improving performance.

Usage

Syntax

Compact_management (in_workspace)
ParameterExplanationData Type
in_workspace

The personal or file geodatabase to be compacted.

Workspace

Code Sample

Compact Example (Python Window)

The following Python window script demonstrates how to use the Compact function in immediate mode.

import arcpy
arcpy.Compact_management("c:/landuse.gdb")
Compact Example 2 (stand-alone script)

The following stand-alone script is a simple example of how to use the Compact function in a scripting environment.

# Name: Compact_Example.py
# Description: compact a file geodatabase

#Import the system modules
import arcpy
from arcpy import env

env.workspace = "C:/data/data.gdb"

#Set local variables
gdbWorkspace = env.workspace
arcpy.Compact_management(gdbWorkspace)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015