Best way to document a SQL view
I use Documatic a lot to generate class documentation from comments embedded in the code. Is there a good way to create documentation for SQL views as well? Ideally I want to document each column in the view with HTML markup similar to how I document each method of a class with Documatic.
Discussion (2)2
Comments
Can you post a source code example?
There are two ways to define views, so I'll give you both options:
-
/// bla-bla-bla:<ul> /// <li>Name - Person's name;</li> /// <li>SSN - Person's Social Security number. This is validated using pattern match;</li> /// <li>DOB - Person's Date of Birth.</li></ul> Class view.Person [ ClassType = view, CompileAfter = Sample.Person, DdlAllowed, Not ProcedureBlock, ViewQuery = { select Name,SSN,DOB from Sample.Person} ] { } -
/// This sample persistent class represents a person. /// <p>Maintenance note: This class is used by some of the bindings samples. Class Sample.Person Extends (%Persistent, %Populate, %XML.Adaptor) { ... /// bla-bla-bla:<ul> /// <li>Name - Person's name;</li> /// <li>SSN - Person's Social Security number. This is validated using pattern match;</li> /// <li>DOB - Person's Date of Birth.</li></ul> Query viewPerson() As %SQLQuery [ SqlView, SqlViewName = viewPerson ] { select Name,SSN,DOB from Sample.Person } ... }
Now take a look at these classes from Documatic.