Error 001332

1427
6
05-15-2017 01:41 PM
KarenFolger
Occasional Contributor II

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. 

6 Replies
MichaelMiller2
Occasional Contributor III

You might want to include your script to aid with trouble shooting.

0 Kudos
KarenFolger
Occasional Contributor II

import arceditor
#
# Import arcpy module
import os
import arcpy
from arcpy import env
inSDE = "\\\\server\\ArcSDE Connection Files\\GENgis_GISDB.sde"
env.workspace = inSDE
#
# Get List of Rasters in workspace
fcList = 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)

0 Kudos
Lake_Worth_BeachAdmin
Occasional Contributor III

import arceditor
#
# Import arcpy module
import os
import arcpy
from arcpy import env
inSDE = "\\\\server\\ArcSDE Connection Files\\GENgis_GISDB.sde"
env.workspace = inSDE
#
# Get List of Rasters in workspace
fcList = 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)

0 Kudos
ErikLima
New Contributor III

Hi,

I has this issue too.
Someone have an idea to solution?

Tks!

0 Kudos
Lake_Worth_BeachAdmin
Occasional Contributor III

Here is a script I use

import arcpy

sde_path = r"C:\Users\GIS.sde"

arcpy.env.workspace = sde_path
datasets = 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

0 Kudos
DanielMcBride
New Contributor II

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 os
import arcpy
import 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.

0 Kudos