Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

How to parameterize Server & database name while using Snowflake database

Hi,

I have created Power BI Report with the data connected to Snowflake database. Incase if i want to parametrize the Server name and database name using query parameters how do i do that?  While using SQL Server, Get data-> SQL Server, we get option New parameter, where we define the Servername and database name parameters. But while connecting to Snowflake from Get data option I am unable to parameterize. 

Under Files& Options, Power Query, I have checked the Allow parameter option.

Kindly need help in understanding how Query parameters can be used for setting Server /DB name when conencted to Snowflake database.

Appreciate if anyone can guide on this!

 

Regards,

SGP

 

 

5 REPLIES 5
YashikaAgrawal
Frequent Visitor

Hi, How to use this while passing from DEV to TEST and to PROD, can you please let me know....

create Parameter in Power Query with list of values, add DEV/TEST/PROD as values.
Then connect to snowflake using embedded connector and then change code in Power Query:
parameter name: ENV
old code "DATA_BASE_NAME_DEV"
new code with parameter "DATA_BASE_NAME_"&ENV

Syndicate_Admin
Administrator
Administrator

After you have created the parameter for server and database, you can get the database normally, in this point you can't specify the parameters but after select the table and load you can go to View section and open the Advanced Editor.

There you will see the lines to load the source, database, schema and table, so there you can update the hardcode text by your parameters.

On above image I let highlight in yellow the parameters that I used.

 

marcingalazkaMO
Frequent Visitor

but how to parameterize Schema? The bold part in below code? It cannot be by concatenation, becasue later we have a list...

TPCDS_SF10TCL_Schema = SNOWFLAKE_SAMPLE_DATA_Database{[Name="TPCDS_SF10TCL",Kind="Schema"]}[Data]

Vijay_A_Verma
Super User
Super User

You will have to use Parameters to create paramters for server and db name and use that. Below I have created 2 parameters Server and DB and passing to Snowflake.

If you have never created parameters in PQ - https://support.microsoft.com/en-us/office/create-a-parameter-query-power-query-5eb365bc-3982-4ab2-8... 

let
    Source = Snowflake.Databases(Server,DB"),
    SNOWFLAKE_SAMPLE_DATA_Database = Source{[Name="SNOWFLAKE_SAMPLE_DATA",Kind="Database"]}[Data],
    TPCDS_SF10TCL_Schema = SNOWFLAKE_SAMPLE_DATA_Database{[Name="TPCDS_SF10TCL",Kind="Schema"]}[Data],
    WEB_PAGE_Table = TPCDS_SF10TCL_Schema{[Name="WEB_PAGE",Kind="Table"]}[Data]
in
    WEB_PAGE_Table

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.