The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I created a custom connector for PowerBI using the Power Query SDK. When I run it in PowerBI the result is always "Query1" (for the frist one, Query2 for the second, etc.).
Is there any way I can set the naming schema of the query using the SDK?
@JustSomeGuy I told you about the default query names. We can request Microsoft for this feature. isnt it?
In Power Query SDK, the default query names like "Query1" and so on. it doesn't provide a direct method to set a custom naming schema for these queries programmatically. You can choose Power BI Desktop.
I am sharing you 2 document likes so that it can assit you further
SDK Dcumentation : https://learn.microsoft.com/en-us/power-query/install-sdk
SDK in Vs Code: https://learn.microsoft.com/en-us/power-query/power-query-sdk-vs-code
the query must from Navigation Table, you can see this link: NavigationTable.pq
Thank you for the suggestion, but I tried the code in the link and the outcome still says "Query1".
Maybe your code is wrong, or I misunderstood your problem. Here are the code and screenshots.
shared TestRename.Contents = (optional message as text) =>
// START!!!!
SampleTable();
SampleTable = () =>
let
objects = #table(
{"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},
{
{"JustSomeGuy", "item1", #table({"Column1"}, {{1}}), "Table", "Table", true},
{"Item2", "item2", #table({"Column1"}, {{2}}), "Table", "Table", true}
}
),
NavTable = Table.ToNavigationTable(objects, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
NavTable;
Table.ToNavigationTable = (
table as table,
keyColumns as list,
nameColumn as text,
dataColumn as text,
itemKindColumn as text,
itemNameColumn as text,
isLeafColumn as text
) as table =>
let
tableType = Value.Type(table),
newTableType = Type.AddTableKey(tableType, keyColumns, true) meta [
NavigationTable.NameColumn = nameColumn,
NavigationTable.DataColumn = dataColumn,
NavigationTable.ItemKindColumn = itemKindColumn,
Preview.DelayColumn = itemNameColumn,
NavigationTable.IsLeafColumn = isLeafColumn
],
navigationTable = Value.ReplaceType(table, newTableType)
in
navigationTable;
// END!!!!!
// Data Source Kind description
After generating the extension and loading it into Power BI and clicking on it in the connector list:
After clicking the OK button:
Hi @JustSomeGuy ,
I checked the official documentation, but it seems that there is no way to set it. You might try to define the name yourself:
let
Query1 = YourQueryFunction1(),
Query2 = YourQueryFunction2()
in
Record.FromList({Query1, Query2}, {"Query1", "Query2"})
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.