0

As you know, you can store feature classes in arcsde in two ways.

Firts, in the root path: sde_conn_file.sde/FeatureClass

Second, in a dataset: sde_conn_file.sde/DataSet/FeatureClass

How can I register as a versioned the feature class that given second example?

I tried the code given below but, it doesn't work.

    FCList = arcpy.ListFeatureClasses("*","All","DATASETNAME")
    for fc in FCList:
        arcpy.RegisterAsVersioned_management(fc,"NO_EDITS_TO_BASE")
3
  • Would you be able to use the edit button to revise your Question, please? At the moment I am not understanding what you are asking.
    – PolyGeo
    Mar 24 '14 at 7:28
  • The feature classes on the root (not in any dataset) works fine for me. But when I try to register as versioned a feature class (that is in a featuredataset) should I run arpy.resgisterAsVersioned for dataset or feature class? Mar 24 '14 at 7:32
  • Please use the edit button beneath your Question to revise it with clarifications rather than creating a trail of Q&A in comments.
    – PolyGeo
    Mar 24 '14 at 8:01
3

You must register the entire dataset as versioned. You cannot single out a specific feature class within the dataset.

database = "C:/Test.gdb"

def versionData(database):
    arcpy.env.workspace = database
    dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListDatasets()
    for data in dataList:
        #skips the compress log table if present
        if "compress" not in data:
            try:
                arcpy.RegisterAsVersioned_management(data, "NO_EDITS_TO_BASE")
            except Exception as e:
                print "Error handling: {0}".format(data)
                print e.message
                continue

versionData(database)
3
  • in your code, ListFeatureClasses doen not include features in the Datasets. So you mean, ListDatasets is enough for as an input to ResgiterAsVersioned? @GISer Mar 25 '14 at 7:21
  • 1
    Yes, ListDatasets is enough but it will only register the features inside the dataset as versioned. Any feature classes or tables outside the dataset will not be versioned. That's why in my code I have: dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListDatasets()
    – ianbroad
    Mar 25 '14 at 15:49
  • The above code should version EVERYTHING that's inside the database. Including everything in the dataset and everything outside.
    – ianbroad
    Mar 25 '14 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.