Hey Everyone,
I am wondering if anyone has got a simple script that they have that will iterate over all feature classes within my Enterprise Geodatabase, and return only the ones that are Registered as Versioned?
Sounds simple enough, I just haven't found an arcpy tool that will return versioned or not versioned.
Cheers
Solved! Go to Solution.
Ben, you might want to look through this thread.
The arcpy 'isversioned' is part of the 'describe' properties of a featureclass.
You need to cycle through the featureclasses and see if it meets the case
isVersioned (Read Only)Indicates whether the dataset is versioned.
Boolean
Ben, you might want to look through this thread.
The arcpy 'isversioned' is part of the 'describe' properties of a featureclass.
You need to cycle through the featureclasses and see if it meets the case
isVersioned (Read Only)Indicates whether the dataset is versioned.
Boolean
Exactly what I am looking for, thanks Dan.
For anyone interested, below is the full code I used to do the following workflow:
# set workspace
arcpy.env.workspace = r'Database Connections\GISADMIN@SDE_Spatial@SDE-DB.sde'
# build list of datasets
datasets = arcpy.ListDatasets()
#iterate over datasets
for dataset in datasets:
# pull back information about the dataset
description = arcpy.Describe(dataset)
# ignore datasets that contain vegetation data
if 'vegetation' not in dataset:
# find if dataset is versioned
if description.isVersioned:
# unregister as versioned the dataset
arcpy.UnregisterAsVersioned_management(in_dataset=dataset,
compress_default="COMPRESS_DEFAULT"
)
Thanks again for your help Dan.