ERROR 001333: Unregister as versioned is not supported for a dataset in a feature dataset

442
4
09-19-2017 07:34 AM
Highlighted
New Contributor II

Hello - I created an Arcpy script that will unregister a table as versioned, truncate the data, register the data as versioned and then cleans up the data. The data is not stored in a feature dataset nor does one exist in the geodatabase. The script runs fine in Pyscripter but when I add it to a Script Tool in ArcCatalog I get the following error when I run it:

ERROR 001333: Unregister as versioned is not supported for a dataset in a feature dataset

Does anyone have an idea what could be happening? I have searched around but I haven't been able to find anything about this error happening to others.

Thanks,

Vince

Reply
0 Kudos
4 Replies
Highlighted
Occasional Contributor III

Why are you unregistered, then truncating the table, only to registered it?  It kinda defeats the purpose of versioning.  You can truncate a versioned table.

As for the error, it would be helpful to see your script.  Can you post the code or at least the part that is having the problem?  I have seen this error when working with a table that is part of a relationship.  But if it works in pyscripter but not ArcGIS, it is most likely a parameter problem (can't simply use sys.argv, you need to use the arcpy.GetParameter) or a syntax issue.

Reply
0 Kudos
Highlighted
MVP Regular Contributor

Versioned data is not supported for the Truncate tool:

Truncate Table—Help | ArcGIS Desktop 

Versioned data is not supported as input. Data must be unregistered as versioned before the tool will execute successfully.

Highlighted
Occasional Contributor III

You are right.  For versioned tables use the Delete Rows tool.

Highlighted
New Contributor II

I forgot to mention that I have another version of the script that uses the Delete tool and that does not cause an error but it takes a very long time to complete since the table has 318K records and it is growly quickly. I was trying speed the deleting process so I thought I would try Truncate. The script is below. I currently don't have any parameters and have hard coded the workspace in the code. Thanks.

# Import arcpy module
import arcpy, datetime, pymssql
#from arcpy.da import SearchCursor

#connection to the SDE databse
workspace = arcpy.env.workspace = "Database Connections\AutoAssign_Test.sde"

print "Unregister MVIEW as versioned"
arcpy.AddMessage("Unregister MVIEW as versioned")
arcpy.UnregisterAsVersioned_management("dbo.MVIEW", "NO_KEEP_EDIT", "NO_COMPRESS_DEFAULT")
print "Truncate MVIEW"
arcpy.AddMessage("Truncate MVIEW")
arcpy.TruncateTable_management("dbo.MVIEW")
print "Register MVIEW as versioned"
arcpy.AddMessage("Register MVIEW as versioned")
arcpy.RegisterAsVersioned_management("dbo.MVIEW", "EDITS_TO_BASE")

Reply
0 Kudos