Situation
I am currently helping a friend with a ArcGIS problem. She is familiar with ArcGIS but not with programming and I am familiar with programming but not with ArcGIS :-) .
We have a layer LAYER1 that was created via "Create Layer from Selected features" from another layer LAYER0, of which some features were selected via a SQL query 'Select by Attribute' (Open Attribute Table -> Select by Attribute).
Question
How do I extract the original SQL query, which was applied on LAYER0, from LAYER1 via Python/arcpy?
Background
(Why do I want to know it)
The servers of network drives have changed. Solutions to updated the path names are described here. We updated the data sources' path names via appying findAndReplaceWorkspacePaths on the mxd file, which was successful. Unfortunately, all feature selections of layers created by "Create Layer from Selected features" got lost for an unknown reason. We also tried applying replaceDataSource on each layer, which suchseccessfully updated the data path but also removed the selections. In the referenced article it is suggested to "update Layer object's definitionQuery". However, when I get the definitionQuery of one layer variable LAYER (LAYER.definitionQuery), I only get an empty string ... . Now, my plan is to extract the SQL queries and recreated the layers via arcpy.SelectLayerByAttribute_management from the old SQL queries.