Select to view content in your preferred language

UnregisterAsVersioned python command fails

450
2
02-26-2025 09:52 AM
PierreMasson
Frequent Contributor

Hi,

I have GDB that is register as Traditional versionning with data in it. There is no version. Only the default and all edits have been saved.

Now I want to unregister it for versionning to be able to register it again but for Branch versioning this time. And I don't want to loose my data.

There are many Fetures classes (in feature datasets) and a lot of table in my GDB. So I write a python script to do that. I read every documentation possible. Here's what my script do.

arcpy.management.DisableArchiving('table1')

arcpy.management.UnregisterAsVersioned('table1', 'KEEP_EDIT', 'COMPRESS_DEFAULT')

 

This works for some table but for others it don't and I can find a reason why some work and some don't.

that is the error I get:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 33373, in UnregisterAsVersioned
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 33369, in UnregisterAsVersioned
gp.UnregisterAsVersioned_management(*gp_fixargs((in_dataset, keep_edit, compress_default), True))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 532, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
arcgisscripting.ExecuteError: ERROR 000101: The dataset xyzx.sde.table1 contains edits to some versions.
Failed to execute (UnregisterAsVersioned).

But If I do this using the UI, it works fine. I don't want to click "Manage", ok, etc for all the elements in my GDB. There are more than 100... 

Can you help?

0 Kudos
2 Replies
ChrisUnderwood
Esri Regular Contributor

Hello @PierreMasson , there is a very old Fixed bug NIM046616, which described what you are seeing. Maybe there has been some sort of regression that has allowed it to reappear ?

Does the Unregister As Versioned tool work for you in Model Builder ? If so, you might be able to use that to integrate through your datasets.

0 Kudos
PierreMasson
Frequent Contributor

Seems to work better with the ModelBuilder but If I make edit in a table or feature class in traditional versioning and save those edits, then the unregister command fails saying that there are edit. I have to unregister them manually and then it works.

0 Kudos