dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer

Home Page:https://dbatools.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get-DbaDependency's documentation should say how it finds dependencies

ReeceGoding opened this issue · comments

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.

@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.