I'm getting this error in a script trying to loop through a SQL Enterprise GeoDB and Register As Versioned all the Feature Classes within it. It keeps telling me I'm trying to do this on a Feature Dataset but there aren't any feature datasets in the GeoDB. I'm doing a describe to check for feature class since there are some tables. What is this about? Tried in 10.4.1 and 10.5.
Did you ever figure out a way around the error? Specifically, arcpy telling you the feature classes couldn't be registered as versioned because they were part of a feature dataset [even though they weren't part of a feature dataset]? I'm running into this now in an Oracle GDB. Script below:
import osimport arcpyimport time
arcpy.env.workspace = "Database Connections\\_MVR NAVCHARTS.sde\\"
fcList = arcpy.ListFeatureClasses("NAVCHARTS*")lockedList = []for fc in fcList:if arcpy.Describe(fc).isVersioned:print fc + " already registered as versioned "+time.asctime()else:if arcpy.TestSchemaLock(fc):print fc + " registering feature class as versioned "+time.asctime()arcpy.RegisterAsVersioned_management(fc, "NO_EDITS_TO_BASE")else:print fc + " feature class locked, adding to locked list "+time.asctime()lockedList.append(fc)
print "feature classed registered"+time.asctime()print "following feature classed were locked and not registered: " + lockedList
This seems to handle the already-versioned and the locked feature classes as intended, but gives me the same error (001332) when it hits an unregistered and unlocked feature class.
Here is a script I use
import arcpysde_path = r"C:\Users\GIS.sde"arcpy.env.workspace = sde_pathdatasets = arcpy.ListDatasets('*', 'ALL')failedData = []sucdata = []for data in datasets: try: arcpy.RegisterAsVersioned_management(data, 'NO_EDITS_TO_BASE') sucdata.append(data) print str(data) + " completed" print "\n" except arcpy.ExecuteError: failedData.append(data) print str(data) +' failed' print arcpy.GetMessages(2) print "\n" continueprint 'list of data sets that successfully enabled versioning...'for item in sucdata: print itemprint "\n"print 'List of Data Sets which failed to register as Versioned'for item in failedData: print item
import arcpy
sde_path = r"C:\Users\GIS.sde"
arcpy.env.workspace = sde_pathdatasets = arcpy.ListDatasets('*', 'ALL')failedData = []sucdata = []for data in datasets: try: arcpy.RegisterAsVersioned_management(data, 'NO_EDITS_TO_BASE') sucdata.append(data) print str(data) + " completed" print "\n" except arcpy.ExecuteError: failedData.append(data) print str(data) +' failed' print arcpy.GetMessages(2) print "\n" continue
print 'list of data sets that successfully enabled versioning...'
for item in sucdata: print item
print "\n"print 'List of Data Sets which failed to register as Versioned'for item in failedData: print item
import arceditor## Import arcpy moduleimport osimport arcpyfrom arcpy import envinSDE = "\\\\server\\ArcSDE Connection Files\\GENgis_GISDB.sde"env.workspace = inSDE## Get List of Rasters in workspacefcList = arcpy.ListFeatureClasses()for fc in fcList:# desc = arcpy.Describe(fc) if desc.dataType == "FeatureClass":# Process: Register As Versioned arcpy.AddMessage("Trying: " + fc) # outFC = os.path.join(inSDE, fc) arcpy.RegisterAsVersioned_management(outFC, "NO_EDITS_TO_BASE") arcpy.AddMessage(fc + " Registered as Versioned") ## Process: Change Privileges arcpy.ChangePrivileges_management(outFC, "public", "GRANT", "") arcpy.AddMessage(fc + " Granted Public permissions") ## Process: Add Global IDs arcpy.AddGlobalIDs_management(outFC) arcpy.AddMessage(fc + " now has Global IDs")# else: arcpy.AddMessage("Skip table: " + fc)
Hi,
I has this issue too.Someone have an idea to solution?
Tks!
You might want to include your script to aid with trouble shooting.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.