Is there a way to query a SSDT project to get a list of tables or foreign keys? Similar to what you can do with the actual database?
Does MS provide a way to query a SSDT project
ssdt
Related Question
- Excluding a specific table from a SSDT deploy
- SSRS – Specify Windows Account for SSRS Data Source in SSDT Project
- SSDT – How to Refresh Reference to Objects in Visual Studio
- Visual Studio SSDT Unresolved Reference to SSISDB – How to Fix
- How to avoid dropping schemas when publishing DB in SSDT Database project
- SSDT for Visual Studio 2017 – Missing Integration Services
Best Answer
YES! You can query the output to an SSDT project called a dacpac using the DacFx.
The easiest way is to grab this sample project from microsoft (https://github.com/microsoft/DACExtensions/tree/master/DacFxStronglyTypedModel) and build the "DacExtensions" dll then reference that from your own code (c#, powershell etc.)
When you use the DacExtensions you can then you can ask for a list of tables or foreign keys, have a look at this:
https://stackoverflow.com/questions/40747082/finding-data-type-information-for-certain-objects-in-dacfx-api
The question shows how to get the TSQLModel and the answer has how to get a list of tables.
Good luck!