Is there any way to get version of a layer loaded using
arcpy.MakeFeatureLayer_management in arcpy with mssql server connection. There are tools that be used for several types of version related tasks like
arcpy.CreateVersionedView_management etc. but i want to know is there any way to know version of the that temporary layer in arcpy.
I tried Listing ArcSDE versions using ArcPy? but it gives all the version in a sde connection- but i want to know specifically with which version layer is loaded.So i do not want
arcpy.Describe but all in vain.
Below is the pseudocode-
arcpy.CreateDatabaseConnection_management("path","Test1.sde","SQL_SERVER","instance","DATABASE_AUTH","user","pass","SAVE_USERNAME","sde__my","#","TRANSACTIONAL","DBO.Test1","#") Above line does not change the version to "DBO.Test1" if i run as above but if i run the gui tool it works perfectly so i need to check if version changed. mywrk = r"path\Test1.sde" fc_cor1 = r'path\Test1.sde\sde__my.DBO.FIPS2900\sde__my.DBO.testfc_1' fc_cor2 = r'path\Test1.sde\sde__my.DBO.FIPS2900\sde__my.DBO.testfc' arcpy.MakeFeatureLayer_management(fc_cor1,'fc1') arcpy.MakeFeatureLayer_management(fc_cor2,'fc2') Now i want to know if version of 'fc1' and 'fc2' is DBO.Test1 otherwise change as below- try: arcpy.ChangeVersion_management("fc1","TRANSACTIONAL","DBO.Test1") arcpy.ChangeVersion_management("fc2","TRANSACTIONAL","DBO.Test1") except: pass
I am using ArcGIS 10.1 and MSSQL Server 2012