I want to add a sql view, generated in slq server, on ArcMap document, through python script.
My sql view has this fields:


My script is:
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
lyr = arcpy.mapping.Layer(r'Database Connections\xyzxy.sde\xyzx.dbo.Lay1')
arcpy.mapping.AddLayer(df,lyr)
This script load lyr on ArcMap temporaly, but when I want to acces to Attribute table, see this error:

I don´t know how to indicate to python, wich field from Lay1 contain oid, in my case OBJECTID field.
I guess your help, thanks.