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.

  • 0
  • 0
  • 163
  • 1
  • 1

Answers

There are two ways to define views, so I'll give you both options:

  1. /// 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.PersonDdlAllowedNot ProcedureBlockViewQuery = { select Name,SSN,DOB from Sample.Person} ]
    {
    
    }
  2. /// 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 SqlViewSqlViewName viewPerson ]
    {
    select Name,SSN,DOB from Sample.Person
    }
    
    ...
    
    }

Now take a look at these classes from Documatic.

Comments