Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Query Folding is not enabled for custom connector with source as API

I am following the query folding apparoch and having below version of TableView. GetTableView = (tableName as text) as table => let schemaPreview = GetTableData(tableName, [PageNumb...
  • v-kpoloju-msft's avatar
    1 year ago

    Hi Anonymous,
    Thank you for posting your query in Microsoft Fabric Community Forum.

    Based on your implementation, the root cause is that query folding is not being triggered because Table.View has null as its first argument. For query folding to work, this should be a valid data source reference, not null.

    Additionally, your Web.Contents call should use the RelativePath and Query fields for Power BI to recognize the call as foldable. I suggest the following steps which are useful to you.

    1. Replace null in Table.View with a valid source object like [Name = "MyCustomAPI", Kind = "MyCustomConnector"].
    2. Update Web.Contents to use RelativePath and Query instead of concatenated URLs.
    3. Ensure you handle options[RowFilters] properly and log it temporarily to check if folding is happening.

    Also, here I provided some official Microsoft Documents for more information:
    Table.View - PowerQuery M | Microsoft Learn
    TripPin 10 - Basic Query Folding - Power Query | Microsoft Learn
    Understanding query evaluation and query folding in Power Query - Power Query | Microsoft Learn
    OData comparison operator reference - Azure AI Search | Microsoft Learn

    There is a detailed community discussion that covers these folding requirements in the context of Table.View, which you may find helpful:
    Can we enable folding for custom query

    Please check whether the schema is correctly typed and that your filter expression uses valid OData syntax. Also, make sure your API respects these query parameters.

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Community Forum.