ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Geodatabase Compare

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Compares feature classes and tables in a test geodatabase to those in a base geodatabase. This tool also performs an enhanced field comparison between objects in the base and test geodatabases. Results of the comparison are written to an output log file.

Usage

  • This tool invokes Feature Compare and Table Compare for each matching set of dataset and table names found in the base and test geodatabases. The outputs from each execution of Feature Compare and Table Compare are appended to a single output file.

  • Base Geodatabase and Test Geodatabase do not have to be the same geodatabase type. However, field and data type differences between types may cause the tool to find miscompares. Coverage or shapefile workspaces are not supported.

  • This tool searches a list of dataset and table names from Test Geodatabase for each dataset and table name in Base Geodatabase. Enterprise geodatabases may contain duplicate dataset or table names that are owned by different user accounts. Object comparison between the geodatabases is done by dataset or table name only. If the connecting account for Test Geodatabase has access to duplicate dataset or table names, only the last–listed dataset or table name found will be compared to a matching item in Base Geodatabase. You can limit permissions in Test Geodatabase to control this.

  • Sort Field must exist in each feature class and table in both Base Geodatabase and Test Geodatabase. If it does not, the tool will return ERROR 00080: The value is not a member of <field list> and stop execution. Continue Compare will not affect this behavior.

  • Compare Type defaults to ALL. The ALL option includes spatial reference, field properties, attributes, and geometry.

  • If Compare Type is set to ALL or SCHEMA_ONLY, the tool performs enhanced field checking. Fields missing from either the base or test object are written to Output File.

  • If Compare Type is set to ALL or ATTRIBUTES_ONLY, the tool omits noneditable fields from execution. See the Omit Fields parameter of Feature Compare and Table Compare.

  • If set, the following Ignore Options are not used when comparing tables in Base Geodatabase and Test Geodatabase:

    • IGNORE_M
    • IGNORE_Z
    • IGNORE_POINTID
    • IGNORE_REPRESENTATIONCLASSES

Syntax

arcpy.defense.GeodatabaseCompare(Base_Geodatabase, Test_Geodatabase, Sort_Field, Compare_Type, Output_File, {Ignore_Options}, {Continue_Compare}, {Errors_Only})
ParameterExplanationData Type
Base_Geodatabase

The Base Geodatabase contains feature classes and tables that you have declared valid. Items in the Test Geodatabase are compared to these feature classes and tables.

Workspace
Test_Geodatabase

Items in the Test Geodatabase are compared to those in the Base Geodatabase.

Workspace
Sort_Field
[Sort_Field,...]

The field or fields used to sort records in each object in the Base Geodatabase and Test Geodatabase. The records are sorted in ascending order. Sorting by a common field in both base and test objects ensures that you are comparing the same row from each input dataset. Separate multiple field names with a semicolon: OBJECTID;CNTRY_NAME.

String
Compare_Type

Indicates which feature class and table properties will be compared. Compare types GEOMETRY_ONLY and SPATIAL_REFERENCE_ONLY are ignored for tables.

  • ALL —All properties of the feature classes will be compared. This is the default.
  • GEOMETRY_ONLY —Only the geometries of the feature classes will be compared.
  • ATTRIBUTES_ONLY —Only the attributes and their values will be compared.
  • SCHEMA_ONLY —Only the schema of the feature classes will be compared.
  • SPATIAL_REFERENCE_ONLY —Only the spatial references of the two feature classes will be compared.
String
Output_File

Output file that will contain the comparison results between feature classes and tables in Base Geodatabase and Test Geodatabase. This includes a list of objects in one geodatabase but not the other. The output text file is comma delimited and can be used as a table in ArcGIS.

File
Ignore_Options
[Ignore_Options,...]
(Optional)

Instructs the tool to ignore specified properties during comparison.

  • IGNORE_M —Do not compare measure properties.
  • IGNORE_Z —Do not compare elevation properties.
  • IGNORE_POINTID —Do not compare point id properties.
  • IGNORE_EXTENSION_PROPERTIES —Do not compare extension properties.
  • IGNORE_SUBTYPES —Do not compare subtypes.
  • IGNORE_RELATIONSHIPCLASSES —Do not compare relationship classes.
  • IGNORE_REPRESENTATIONCLASSES —Do not compare representation classes.
String
Continue_Compare
(Optional)

Indicates whether to compare all properties after encountering the first mismatch.

  • NO_CONTINUE_COMPARE —Stops after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARE —Compares other properties after encountering the first mismatch.
Boolean
Errors_Only
(Optional)

Indicates whether to write all results or only error results to the Output_File.

  • NOT_ERRORS_ONLY —Write all comparison results to the Output File. This is the default.
  • ERRORS_ONLY —Write only comparison error results to Output_File.
Boolean

Code sample

GeodatabaseCompare example (Python window)

The following code demonstrates how to use the GeodatabaseCompare tool.

# Name: GeodatabaseCompare_Example.py
# Description: Compares feature classes and tables in base and test workspaces
# Requirements: ArcGIS Defense Mapping solution

import os

# set our current workspace
arcpy.env.workspace="c:/data"

# define the base and test workspaces
baseWorkspace="MGCP_TRD4.gdb"
testWorkspace="MGCP_TRD4_test.gdb"

# define a field to sort by
sortField="OBJECTID"

# define an output file - will be written to env.workspace
outFile="geodbCompareFile.txt"

# execute the Geodatabase compare tool
res = arcpy.GeodatabaseCompare_defense(baseWorkspace,testWorkspace,sortField,"ALL",outFile,"","CONTINUE_COMPARE","ERRORS_ONLY")

# check for the file
print os.path.exists(os.path.join(arcpy.env.workspace,outFile))

Environments

  • Current Workspace

Licensing information

  • Basic: No
  • Standard: Requires Defense Mapping
  • Advanced: Requires Defense Mapping

Related topics

  • An overview of the Validation toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal