Power Query M Parser for Java

General SQL Parser (GSP) reads Power Query M with an extractor-grade grammar built for data lineage: it parses let ... in documents and connector calls into an AST, hands Value.NativeQuery() SQL to the matching vendor grammar, and resolves navigation chains to database.schema.table references. One commercial SDK — Power Query M is available in the Java edition.

Weekly
release cadence — dialect fixes ship in days

Power Query M queries that GSP parses

let
  Source = Snowflake.Databases("acct", "WH"),
  DB = Source{[Name="PROD", Kind="Database"]}[Data],
  Result = Value.NativeQuery(DB, "SELECT id, amount FROM PROD.SALES.orders")
in Result

Parse it in Java

import gudusoft.gsqlparser.*;

TGSqlParser parser = new TGSqlParser(EDbVendor.dbvpowerquery);
parser.sqltext = sql; // the Power Query M query above
if (parser.parse() == 0) {
    System.out.println(parser.sqlstatements.size() + " statement(s) parsed");
} else {
    System.out.println(parser.getErrormessage());
}

Java edition only. The .NET library has no Power Query M grammar, so this dialect cannot be parsed from C# or VB.NET. See the .NET SQL Parser SDK for the dialects it does cover.

What GSP handles in Power Query M

Beyond parsing, the same AST powers table/column extraction, validation, formatting, and column-level lineage for Power Query M.

Recent Power Query M parser updates

Full history in the release notes.

Power Query M resources

Common questions

Do I need a live Power Query M connection to validate queries?

No. GSP validates Power Query M syntax completely offline. You get error line and column positions, the offending token, and a hint — with no server, driver, or credentials involved.

Can I use the Power Query M parser from C# / .NET?

Not currently. Power Query M is a Java-edition dialect — the .NET library ships 15 dedicated grammars and Power Query M is not one of them, so there is no C# code path for it. Everything else on this page describes the Java SDK. If you need Power Query M in .NET, email info@sqlparser.com; customer demand is how dialects get prioritized for the .NET port.

Can GSP extract column-level lineage from Power Query M queries?

Yes. The built-in DataFlowAnalyzer produces column-level lineage, impact analysis, and call graphs from Power Query M scripts — it is the engine behind Gudu SQLFlow and the lineage integrations for DataHub and OpenMetadata.