dbatools
dbatools copied to clipboard
Get-DbaDependency's documentation should say how it finds dependencies
Summarize Functionality
Neither reading Get-DbaDependency
's documentation nor skimming its source code has made how it finds dependencies obvious. There are many methods for finding dependencies in SQL and none of them are perfect. If users knew what method was used and what it misses, then they would be more confident in using Get-DbaDependency
.
Is there a command that is similiar or close to what you are looking for?
No
Technical Details
No technical details needed. This is only a documentation change.
Just a simple addition to hopefully make the closing of this issue easier.
Tracking down the logic from the Get-DbaDependency
through the used there SMO
classes/objects I believe that the method used is the buildin views method and I believe so due to the use of sys.sql_expression_dependencies through-out the SMO
repo.
@ReeceGoding / @userwiths : dbatools uses SMO, and that command uses dependency tracking via SMO just like SSMS does. This means that if SMO is able to trace dependencies dbatools will, too. Excluding bugs, that means basically that everything is within scope EXCEPT dynamic sql, where it's quite impossible to track down dependencies .... would a "This command uses SMO to track dependencies, so everything except dynamic sql" note on the help suffice ?
Works for me, might want to wait and hear back from OP tho.
@niphlod That works for me. Ideally, a hyperlink to the relevant SMO's docs would also be included.
@ReeceGoding , something like https://learn.microsoft.com/en-us/dotnet/api/microsoft.sqlserver.management.smo.dependencywalker.discoverdependencies?view=sql-smo-160 or https://github.com/microsoft/sqlmanagementobjects/blob/main/src/Microsoft/SqlServer/Management/Smo/DependencyWalker.cs is okay ? dunno how much "clear" it'd be , even linking it.
@niphlod Yeah, that's all that I had in mind. I was hoping that there would be a smoking gun showing a DMV clearly being used, but what you have found is the best we'll get.