Select to view content in your preferred language

Unregister As Versioned Issues

1220
1
04-20-2012 08:12 PM
NathanHeick
Frequent Contributor
What is the appropriate way to register and unregister tables as versioned in ArcSDE using Python?  I am trying to do this for most of our geodatabase tables by iterating over the children of the ArcSDE workspace, but I am seeing discrepancies between the results of arcpy.Describe(dataset).isVersioned and arcpy.UnregisterAsVersioned().  The isVersioned attribute will return True while the UnregisterAsVersioned function will throw an exception that the object is not registered as versioned.  I have tried unregistering the feature datasets directly, as well as first iterating over their children just to be sure I have hit each child dataset.  Ignoring the exceptions, the A and D tables are not cleaning up.  I am still getting attributed relationship classes and geometric network tables left behind, despite specifically calling UnregisterAsVersioned on all of these objects.  My assumption is that attributed relationship classes and geometric networks can be passed to arcpy.UnregisterAsVersioned since they have tables that would be need to be versioned.

Any help explaining the geodatabase structure better and why this is happening would be appreciated.

Thanks,


Nathan
Tags (2)
0 Kudos
1 Reply
NathanHeick
Frequent Contributor
For anyone who is reading this thread, I have found some insight to the problem.  First of all, the script was iterating through the children of the ArcSDE workspace and was unregistering stand-alone tables first.  This would unregister related feature classes in the feature datasets and the feature datasets themselves.  Also, due to this sort of behavior, the Describe object I was obtaining at the start of the script, whose children I was iterating over, became stale as tables were being unregistered.  A table could be unregistered before it was reached in the iteration, causing the errors I was seeing.  I am still not sure of the right approach, but the following approach has worked.

1.  Use arcpy.ListDatasets() to iterate over the feature datasets and unregister them first.  If they are unversioned already, iterate over all child feature classes in the feature datasets and unregister them.  Then, iterate over stand-alone feature classes and tables.
2.  Ignore geometric networks and relationship classes.  The new order I am using has deleted all but one of the A and D tables, so that is progress.  Also, I am going to delete the geometric networks and relationship classes, and rebuild them later, so this is good enough.
3.  Use arcpy list functions first and only use describe objects as needed at the time they are needed.

This solved any problems I was having except the one set of A and D tables for one attributed relationship class.

I would still like to learn more about how unregistering the attributed relationship classes and geometric networks works in terms of the A and D tables.
0 Kudos