Forum Discussion
Incremental refresh for custom connector with call to REST API: RangeStart and RangeEnd
- 2 years ago
Finally we found the solution:
It is all up to query folding. The article helped a lot:
https://bengribaudo.com/blog/2022/01/20/6500/power-query-m-primer-part-23-query-folding-i
One does not need to define RangeStart nor RangeEnd parameters anywhere in the connector.
Instead one should implement Table.View as shown here:
https://learn.microsoft.com/en-us/power-query/samples/trippin/10-tableview1/readmeThe only missing information is that one need to implement OnSelectRows.
Further information:
https://community.fabric.microsoft.com/t5/Power-Query/Query-folding-Table-View-handler-function-to-filter-rows-add/td-p/3154149br, Michael
yes! But we are talking about a custom connector. From other posts I learned, that custom connectors have the ability for incremental refresh. Unfortunately I can not find any samples online.
The way incremental refresh works is as follows:
You (the developer) create a Power Query script that access your data source (including via a custom connector). The Power Query code contains a filter for RangeStart (inclusive) and RangeEnd (exclusive). That filter can be in the standard M code or it can be a part of the constructed but visible URL of the custom connector.
The Power BI service is managing the partitions and will inject the appropriate values for RangeStart and RangeEnd into the query for each partition.
If the Power BI service cannot set these parameters in a way that allows your custom connector to consume them then this won't work.
- emikelsoft2 years agoHelper I
Ok, can you give an example for that filter within an custom connector?
- lbendlin2 years agoSuper User
I don't have an example for that. Best I can give you is this
let Source = PowerBIRESTAPI.Navigation(), #"Filtered Rows" = Table.SelectRows(Source{[Key="AppWorkspace"]}[Data]{[Key="RefreshHistory"]}[Data], each DateTime.From([Start Time]) >= RangeStart and DateTime.From([Start Time]) < RangeEnd) in #"Filtered Rows"That likely doesn't fold, so the performance benefits are minimal (the space benefits still apply).
- emikelsoft2 years agoHelper I
There are many examples like this on the internet. But unfortunately not any showing how to so that in a custom connector. Where should RangeStart and RangeEnd be defined. You cannot not just use this patameters without defining them before.
Anyway, thank you for your help