Forum Discussion

wcarter's avatar
wcarter
Advocate II
2 years ago
Solved

Programmatic Data Sources?

Right now I have a pipeline in data factory that imports from on-prem sql twice per day to a "warehouse", that appends all new and changed records from multiple databases (one for each of the last 10...
  • miguel's avatar
    miguel
    2 years ago

    Assuming a few things like:

    • All databases come from the same server
    • The same authentication / credentials used has access to all databases 
    • You have a logic in place to determine what tables to pick from each database correctly

    You can use the SQL Database connector, enter just the server name and that will yield a table with all the available databases inside of the server. From there, you can create your own query with the custom logic of your own or even package your logic as a function that could run against every single database in that server and yield a single query that you could later sink / output / load to a destination of your choice.

     

    The article below might be able to help you with how to create functions:

    Using custom functions in Power Query - Power Query | Microsoft Learn

     

    For the SQL Database connector, you can also simply use the function Sql.Databases:

    Sql.Databases - PowerQuery M | Microsoft Learn