Trouble with Change Version (Data Management) to Historical Marker in Python Script

Discussion created by ajs5325 on Sep 19, 2013
Latest reply on Feb 13, 2018 by chlang5
The problem: I'm having some problems with the Change Version (Data Management) tool.  I'm trying to change the version of my SDE database to a Historical Marker/Timestamp within a python script.  However, the version only changes from sde.DEFAULT to the current time today, instead of the input date and time.  I'm able to successfully change the TRANSACTIONAL version to what I specify in the script, but the HISTORICAL option seems to be a bit buggy.

The gp tool works fine for both TRANSACTIONAL and HISTORICAL inputs, but I need to embed this tool into my custom script.  This leads me to believe that I might be doing something incorrect in my python code.

Has anyone had any troubles with this before or know of a solution to the problem I'm having?  Any help would be much appreciated!

My Computer Setup: I'm running ArcInfo 10.1 on Windows 7.  My SDE is a PostgreSQL Enterprise Geodatabase.  I'm currently working with a test dataset of 100 points that I created two days ago.  This morning, I deleted several of the points in the dataset.

My Code Snipit:
import arcpy, datetime
indata = arcpy.GetParameter(0)   #A feature layer input from the sde.DEFAULT
indate = arcpy.GetParameter(1)   #A date type input parameter (type = datetime)

arcpy.AddMessage(type(indate))#returns datetime.datetime

arcpy.AddMessage("Current Data Count: "+str(arcpy.GetCount_management(indata))) #Correctly returns 75

arcpy.ChangeVersion_management(indata, "HISTORICAL", "", indate)
arcpy.AddMessage("Old Data Count: "+str(arcpy.GetCount_management(indata)))#Returns 75, but should be returning 100