Compress File Geodatabase Data (Data Management)
Compresses all the contents in a geodatabase, all the contents in a feature dataset, or an individual stand-alone feature class or table.
Once compressed, a feature class or table is read-only and cannot be edited. Compression is ideally suited to mature datasets that do not require further editing. However, if required, a compressed dataset can always be uncompressed to return it to its original, read-write format.
When you compress a geodatabase, all feature classes and tables within it compress.
When you compress a feature dataset, all its feature classes compress.
When you specify a geodatabase as input, this tool compresses all vector feature classes and tables in the geodatabase. It does not compress raster catalogs or raster datasets. If it encounters these in the specified geodatabase, it skips over them. You can individually compress a raster catalog or raster dataset with this tool; however, it makes little sense since the data does not reduce in size. This support is provided strictly as a means to allow ArcPublisher to package to compressed and locked file geodatabase raster catalogs and datasets.
You cannot individually compress or uncompress a feature class in a feature dataset to produce a mixed state where some feature classes are compressed and others are not. Compressed feature datasets allow you to add an uncompressed feature class through operations such as creating a new, empty feature class, copying and pasting, and importing. However, you cannot edit the uncompressed feature class if there are compressed feature classes in the same feature dataset. Once you've finished adding one or more uncompressed feature classes, you can recompress or uncompress the feature dataset so all its feature classes are either compressed or uncompressed.
When you display compressed feature class records in ArcCatalog or ArcMap, they may not display in the same order as they did before you compressed the data. The records display in the order in which they are compressed and stored.
The geodatabase, feature dataset, feature class, or table to compress.
|Workspace; Feature Dataset; Table View; Raster Layer|
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")
The following example demonstrates how to use the CompressFileGeodatabaseData function in a standalone python script.
# Name: CompressFileGeodatabaseData.py # Description: Use the CompressFileGeodatabaseData tool to compress a geodatabase # Author: ESRI # import system modules import arcpy, os from arcpy import env # Set environment settings env.workspace = "C:/data" # Set local variables geodatabase = "london.gdb" try: # Process: Compress the data arcpy.CompressFileGeodatabaseData_management(geodatabase) except: # If an error occurred while running the tool print the messages print arcpy.GetMessages()