Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Everyone,
I am attempting to import tables from Snowflake using a SQL statement, specifically targeting tables that contain "PDS" in their names. The objective is to automatically import new tables that include "PDS" in their names and remove those that no longer exist in Snowflake.
Currently, I am using the following query:
However, this query returns a single table with details of all tables that contain "PDS" in their names.
Any suggestions on how to improve this query to meet my requirements would be greatly appreciated.
Tables in Snowflake :
Thank you!
Thank you guys for your Input 🙂
Hi @Dudu24100 ,
Thank you for your response. Please feel free to reach out if you encounter any issues while implementing the provided workarounds. We’re happy to assist you further.
Regards,
Dinesh
Hi @Dudu24100 ,
Thank you for reaching out to the Microsoft Community Forum.
You are using a SQL query to fetch metadata from INFORMATION_SCHEMA.TABLES in Snowflake. However, to dynamically import all tables that contain "PDS" in their name into Power BI, and automatically remove those that no longer exist, you will need to use dynamic import.
To filter for "PDS" tables in the INFOMART schema, please try the below SQL code.
SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'INFOMART'
AND TABLE_NAME LIKE '%PDS%'
Note: This will return all table names that contain "PDS".
I am using Power Query to Dynamically Import Tables. I am using the result of the above query as a list of table names, then loop through them dynamically to load data from each table.
Load metadata: Go to Home --> Get Data --> Snowflake. use the above SQL Query
Convert to List of Fully Qualified Table Names. In Power Query, create a new column with below codes.
= [TABLE_SCHEMA] & "." & [TABLE_NAME]
Or you can use below code.
= "EU_DATATEAM_PRO." & [TABLE_SCHEMA] & "." & [TABLE_NAME]
Loop over the tables using Table.Combine
I have created below function for example:
let
LoadPdsTable = (schema as text, name as text) =>
let
Source = Snowflake.Databases("snowflake_account", "warehouse_name"),
db = Source{[Name="EU_DATATEAM_PRO"]}[Data],
schemaObj = db{[Name=schema]}[Data],
table = schemaObj{[Name=name]}[Data]
in
table
in
LoadPdsTable
Apply function across all rows. Add a custom column that uses this function
LoadPdsTable([TABLE_SCHEMA], [TABLE_NAME])
Expand and Combine the Results
Note: Power BI doesn’t support dynamic table loading unless you refresh metadata and re-import via Power Query each time. You can automate refresh via Power BI Service. You cannot do this in DirectQuery mode due to SQL limitations with metadata-based dynamic evaluation.
If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.
Not something you can do in Power Query. If Snowflake supports the concept of views then you can create a view there that handles the presence/absence of tables, and then you point Power Query to that view.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
12 | |
8 | |
8 |
User | Count |
---|---|
17 | |
10 | |
7 | |
7 | |
7 |