# Name: ExecuteReviewerBatchJob_Example.py
# Description: Executes a reviewer batch job
# Requirements: Data Reviewer extension
# Import arcpy module
import arcpy
# Check out a Data Reviewer extension license
arcpy.CheckOutExtension("datareviewer")
arcpy.env.overwriteOutput="true"
# reviewer workspace
reviewer_db = "c:/gisdata/reviewer.sde"
# reviewer batch job file - corresponds to Finding geometries with spatial relationships doc
SoCal_GeoOnGeoChecks_rbj = "C:/gisdata/SoCal_GeoOnGeoChecks.rbj"
# session - must exist before executing this script.
session = "Session 2 : Session 2"
# production database - contains data to validate
production_db = "C:/gisdata/Edit_Sample.sde"
# aoi extent
Extent_Analysis_Area = arcpy.Extent(-118.02, 33.65, 117.71, 33.94)
# Define spatial reference of analysis area extent using factory code
# GCS_WGS_1984, WKID: 4326
# If spatial reference is not defined the following warning message will appear:
# Spatial reference of the analysis area extent is not defined. Spatial reference is required to ensure that the analysis area extent is compatible with the data sources being validated.
spatial_reference = arcpy.SpatialReference()
spatial_reference.factoryCode = 4326
spatial_reference.create()
Extent_Analysis_Area.spatialReference = spatial_reference
# Execute Reviewer Batch Job function
res = arcpy.ExecuteReviewerBatchJob_Reviewer(reviewer_db, session, SoCal_GeoOnGeoChecks_rbj, production_db, Extent_Analysis_Area, "ALL_FEATURES", "")
# get the output table
tbl = res.getOutput(0)
print tbl.name
# query the table
for row in arcpy.da.SearchCursor(tbl,("RECORDID","BATCHJOBID","BATCHJOBFILE")):
print str(row[0])
print row[1]
print row[2]
# Check in the Data Reviewer extension
arcpy.CheckInExtension("datareviewer")