I have a few questions about the suggested Python scripting for the Analyze Datasets tool. The suggested Python (from Analyze Datasets—Help | ArcGIS Desktop is:
# Import system modules
import arcpy
import os
# set workspace
# the user in this workspace must be the owner of the data to analyze.
workspace = arcpy.GetParameterAsText(0)
# set the workspace environment
arcpy.env.workspace = workspace
# NOTE: Analyze Datasets can accept a Python list of datasets.
# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()
# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
arcpy.env.workspace = os.path.join(workspace,dataset)
dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()
# reset the workspace
arcpy.env.workspace = workspace
# Get the user name for the workspace
userName = arcpy.Describe(workspace).connectionProperties.user.lower()
# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]
# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", dataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
print("Analyze Complete")
Questions:
# set the workspace environment
arcpy.env.workspace=workspace
# NOTE: Analyze Datasets can accept a Python list of datasets.
# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters() + arcpy.ListDatasets('', 'Feature')
# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them as a relative path to the master list
for dataset in arcpy.ListDatasets('','Feature'):
arcpy.env.workspace = os.path.join(workspace,dataset)
fc_list = arcpy.ListFeatureClasses()
for fc in fc_list:
fc_add = os.path.join(dataset, fc)
dataList.append(fc_add)
ds_list = arcpy.ListDatasets()
for ds in ds_list:
ds_add = os.path.join(dataset, ds)
dataList.append(ds_add)
# reset workspace...
Thank you in advance for any clarification or suggestions!