Hello - I've just began to notice that when I have layers in a Pro 2.0.1 or Pro 2.1 map that have a relationship, the related information from the one layer with a relate is then added to the second layer that does not have a relate when running the python function:
arcpy.mp.CreateWebLayerSDDraft()
In my example, I have 2 layers in an ArcPro 2.1 map and project. Parcels and a related Property table, and a second layer, Neighborhood Associations. When I create teh sddraft for Neighborhood Associations, it now contains the related info from both the Parcels AND its related table. I was able to discover this by parsing out the sddraft's xml:
<PropertySetProperty xsi:type='typens:PropertySetProperty'>
<Key>PackageLayerList</Key>
<Value xsi:type='xs:string'>CIMPATH=planning/prod_gis_neighborhoodview.xml</Value>
</PropertySetProperty>
.....
<PropertySetProperty xsi:type='typens:PropertySetProperty'>
<Key>DependantTableList</Key>
<Value xsi:type='xs:string'>EXTERNALPATH=PROD::PROD.GIS.BuildingDetails|EXTERNALPATH=PROD::PROD.GIS.PROPERTY</Value>
</PropertySetProperty>
and by then simply looking at the hosted feature layer after I run the update:
My Neighborhood Associations layer now contains Parcels and it's related tables a layers. That can't be right, and this started happening with the patch release at 2.0.1 as near as I can tell.
You can also see this with our utility water system valves here:
https://sarco.maps.arcgis.com/home/item.html?id=cf962eed5cd3478b8bf71839db8ec423#overview
In this case, the arcpy.mp.CreateWebLayerSDDraft() function thinks that all these layers are related through attachments.
This is happening to any layer that has any relate or attachment relate. I have tried sourcing both our 10.5.1 Enterprise SQL or File GDB.
My guess is most people aren't sharing layers up to AGOL or Portal with this method, and while I haven't found a solution I do have a workaround - place any layers that contain any type of relate into separate Pro map frames as a single map with a single layer.