The Power BI repointing is a feature that provides an easy way to redefine the connections from the M language in the Power Query Editor. This means that the connection parameters will be redefined to point to the Snowflake migration database context. For SQL Server and Azure Synapse, the method in M Language that defined the connection is Sql.Database(...). In Snowflake, there is a connector that depends on some other parameters and the main connection is defined by Snowflake.Database(...) method.
Even a simple connection to a table from Power BI requires many transformations to be used with the implicit Power BI connector from Snowflake. In this case, SnowConvert AI adds new information variables such as database and schema, and calls the source table with the implicit type (it can also be a view).
Also, SnowConvert AI generates a mapping between the columns to match the text case with the database migration context or, if possible, with the Power BI report internal information.
Transact-SQL | Azure Synapse Connection in the Power Query Editor
For the SQL queries embedded inside the connections, SnowConvert AI will extract, migrate, and re-insert these queries. Warning messages in the migrated queries may require extra attention. In this case, the warning message does not stop the query from being run in the Snowflake database.
Transact-SQL | Azure Synapse Connection in the Power Query Editor
:force:
letSource=Sql.Database("your_connection","LibraryDatabase",[Query="SELECT DISTINCT#(lf) B.Title#(lf)FROM#(lf) DBO.Books AS B#(lf)JOIN#(lf) DBO.Authors AS A ON B.AuthorID = A.AuthorID#(lf)JOIN#(lf) DBO.BookGenres AS BG ON B.BookID = BG.BookID#(lf)JOIN#(lf) DBO.Genres AS G ON BG.GenreID = G.GenreID#(lf)WHERE#(lf) A.Nationality = 'American' AND G.Origin = 'USA'#(lf)ORDER BY#(lf) B.Title;", CreateNavigationProperties=false])inSource
Snowflake SQL Connection in the Power Query Editor
:force:
let
SfSource =Value.NativeQuery(Snowflake.Databases(SF_SERVER_LINK,SF_WAREHOUSE_NAME,[Implementation="2.0"]){[Name=SF_DB_NAME]}[Data],"--** SSC-FDM-0007 - MISSING DEPENDENT OBJECTS ""DBO.Books"", ""DBO.Authors"", ""DBO.BookGenres"", ""DBO.Genres"" **
SELECT DISTINCT
B.Title
FROM
DBO.Books AS B
JOIN
DBO.Authors AS A
ON B.AuthorID = A.AuthorID
JOIN
DBO.BookGenres AS BG
ON B.BookID = BG.BookID
JOIN
DBO.Genres AS G
ON BG.GenreID = G.GenreID
WHERE
A.Nationality = 'American' AND G.Origin = 'USA'
ORDER BY B.Title",null,[EnableFolding=true]),Source=Table.RenameColumns(SfSource,{{"TITLE","Title"}})inSource
Embedded SQL Query With Multiple Lines Repointing Case¶
This case showcases the connection with SQL queries and multiple lines of logic after the connection logic.
Transact-SQL | Azure Synapse Connection in the Power Query Editor
:force:
letSource=Sql.Database("your_connection","mytestdb",[Query="SELECT DISTINCT#(lf) P.ProductName,#(lf) P.Category,#(lf) P.StockQuantity#(lf)FROM#(lf) Products AS P#(lf)WHERE#(lf) P.StockQuantity > 0#(lf)ORDER BY#(lf) P.Category ASC;"]),#"Filtered Rows"=Table.SelectRows(Source, each Text.StartsWith([Name],"Cards"))in#"Filtered Rows"
Snowflake SQL Connection in the Power Query Editor
:force:
letSource=Value.NativeQuery(Snowflake.Databases(SF_SERVER_LINK,SF_WAREHOUSE_NAME,[Implementation="2.0"]){[Name=SF_DB_NAME]}[Data],"--** SSC-FDM-0007 - MISSING DEPENDENT OBJECT ""Products"" **
SELECT DISTINCT
P.ProductName,
P.Category,
P.StockQuantity
FROM
Products AS P
WHERE
P.StockQuantity > 0
ORDER BY P.Category ASC",null,[EnableFolding=true]),#"Filtered Rows"=Table.SelectRows(Source, each Text.StartsWith([Name],"Cards"))in#"Filtered Rows"
Embedded SQL Query With Column Renaming Repointing Case¶
At the moment, column renaming for SQL queries cases are only applied if the internal information of the provided Power BI report contains this information.
Transact-SQL | Azure Synapse Connection in the Power Query Editor
Snowflake SQL Connection in the Power Query Editor
:force:
let
SfSource =Value.NativeQuery(Snowflake.Databases(SF_SERVER_LINK,SF_WAREHOUSE_NAME,[Implementation="2.0"]){[Name=SF_DB_NAME]}[Data],"--** SSC-FDM-0007 - MISSING DEPENDENT OBJECT ""Products"" **
SELECT DISTINCT
P.ProductName,
P.Category,
P.StockQuantity
FROM
Products AS P
WHERE
P.StockQuantity > 0
ORDER BY P.Category ASC",null,[EnableFolding=true]),Source=Table.RenameColumns(SfSource,{{"PRODUCTNAME","ProductName"},{"CATEGORY","Category"},{"STOCKQUANTITY","StockQuantity"}})inSource