DataConnectors icon indicating copy to clipboard operation
DataConnectors copied to clipboard

OData expanded navigation property

Open anetab opened this issue 4 years ago • 3 comments

Hi,

I have a one-to-many navigation property in the OData metadata and upon expanding it, PowerBI doesn't use an $expand request. Instead it requests the data for each individual entity in the source set. This leads to many calls to the OData service instead of just one, which seriously impacts performance.

To make the the issue more precise, this my metadata (simplified):

<EntityType Name="BaseContract">
   <Key>
         <PropertyRef Name="Syscode"/>
   </Key>
   <Property Name="Syscode" Type="Edm.Int32"/>
   <NavigationProperty Name="Lifecycles_BaseContractLifecycle" Type="Collection(Planon.BaseContractLifecycle)" Partner="PivotLifecycleRef_BaseContract"/>
</EntityType>

<EntityType Name="BaseContractLifecycle">
  <Key>
    <PropertyRef Name="Syscode"/>
  </Key>
  <Property Name="Syscode" Type="Edm.Int32"/>
  <Property Name="PivotLifecycleRef" Type="Edm.Int32"/>
  <NavigationProperty Name="PivotLifecycleRef_BaseContract" Type="Planon.BaseContract" Partner="Lifecycles_BaseContractLifecycle">
    <ReferentialConstraint Property="PivotLifecycleRef" ReferencedProperty="Syscode"/>
  </NavigationProperty>

Upon expanding the navigation property Lifecycles_BaseContractLifecycle on BaseContract (for example, selecting the Syscode property on BaseContractLifecycle), PowerBI sends a request for each individual BaseContract entity: <root_of_service>/BaseContract(<id>)/Lifecycles_BaseContractLifecycle Instead, I would expect something like this: <root_of_service>/BaseContract?$expand=Lifecycles_BaseContractLifecycle(%24select%3DSyscode)

Am I missing something from the metadata to let PowerBI know it can make such requests? Expanding works fine for one-to-one navigation properties. Or is this the intended behavior? In this case I cannot use the one-to-many navigation because it is not performant for large number of entries.

Thanks in advance for your help!

anetab avatar Oct 08 '19 10:10 anetab