calculate field on sde versioned data

715
1
11-02-2017 09:02 AM
FrancisMoisan
New Contributor II

Hi!

I need to do some update an attribute on a SDE feature class (versioned).

The feature class is within a FeatureDataset.

I want to do a simple calculate field on a specific version of my data (the user will chose the version).

But It fail every time.  I can do this on the DEFAULT version only.

I try something like this

edit = arcpy.da.Editor(workspace)
edit.startEditing(False, True)

#Creating a feature layer (no selection, all the data)

arcpy.MakeFeatureLayer_management(fc,_mon_feature_layer)

#Changing the version
arcpy.ChangeVersion_management(_mon_feature_layer, 'TRANSACTIONAL', _ma_version_cible)

Any Idea?

0 Kudos
1 Reply
TinaMorgan1
Occasional Contributor II

Hi Francis,

First of all, what is the error you are getting when running this script?

A troubleshooting tip would be to add a print statement after the MakeFeatureLayer line.  Seeing the print statement "MakeFeatureLayer complete" ensures us that the layer is successfully being created, and that the failure is definitely occurring during ChangeVersion statement.

Just from reviewing the syntax provided:

The ChangeVersion_Management syntax actually has 4 parameters.  Also, don't forget single quotes, and fully qualified names:

ChangeVersion_management (in_features, version_type, {version_name}, {date})

arcpy.ChangeVersion_management('_mon_feature_layer','TRANSACTIONAL', '<schema>._ma_version_cible','')

0 Kudos