Compress File Geodatabase Data (Data Management)

License Level:BasicStandardAdvanced

Summary

Compresses all the contents in a geodatabase, all the contents in a feature dataset, or an individual stand-alone feature class or table.

Usage

Syntax

CompressFileGeodatabaseData_management (in_data, lossless)
ParameterExplanationData Type
in_data

The geodatabase, feature dataset, feature class, or table to compress.

Feature Dataset; Geometric Network; Raster Layer; Table View; Workspace
lossless

Indicates whether lossless compression will be used.

  • Lossless compressionLossless compression will be used. This is the default.
  • Non-lossless compressionLossless compression will not be used.

This parameter is ignored for pre-10.0 file geodatabases.

Boolean

Code Sample

CompressFileGeodatabaseData example 1 (Python window)

The following example demonstrates how to use the CompressFileGeodatabaseData function in the Python window.

import arcpy
arcpy.env.workspace = "C:/data/"
arcpy.CompressFileGeodatabaseData_management("london.gdb","Lossless compression")
CompressFileGeodatabaseData example 2 (stand-alone Python script)

The following example demonstrates how to use the CompressFileGeodatabaseData function in a stand-alone Python script.

# Name: CompressFileGeodatabaseData.py
# Description: Use the CompressFileGeodatabaseData tool to compress a geodatabase

# import system modules
import arcpy, os
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
geodatabase = "london.gdb"
lossless = "Lossless compression"

try:
  # Process: Compress the data
  arcpy.CompressFileGeodatabaseData_management(geodatabase, lossless)

except:
  # If an error occurred while running the tool print the messages
  print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013