I have a script I'm developing to automate changing the data source from parcels_1 to the original feature class parcels from which I had manually changed source several weeks ago. It was a most tedious task to do manually, and was done for several layers in multiple MXDs, hence my desire to automate it.
The MXD I am using for testing has two layers that have the same feature class for data source, but each has a different definition query to show just the relevant subtypes:
Layer Parcels has definition query "SUBTYPE" <2 OR "SUBTYPE" = 8
Layer RoadROW has definition query "SUBTYPE" BETWEEN 2 AND 5
Both layers are drawn with Unique Value symbology, and in the output MXD, everything draws correctly symbolized on the map from the successfully updated data source. Trouble is in Layer Properties, only RoadROW has a Symbology tab that shows what it did before. The Symbology tab for Parcels has just Single Symbol, and actually entirely lacks Categories as an option to choose. I do not understand why the two layers behave so differently. Perhaps it's because Parcels has two joins and one relate, while RoadROW has neither? The joins come through properly, but the relate does not.
For RoadROW, lyr.symbology.valueField was bcwa.GIS_ADMIN.parcels_1.SUBTYPE before being changed
For Parcels, lyr.symbology.valueField was SUBTYPE already before being changed. I don't know why the difference between the two layers in that regard.
As a work around, in my script I have tried
if "parcels_1" in lyr.symbology.valueField:
lyr.symbology.valueField = 'SUBTYPE'
but when running it I get
Maybe it doesn't matter because lyr.symbology.valueField is already SUBTYPE?
I hesitate to leave the Parcels layer in the state it is in, but ought I even be worried?