MODEL() when it belongs to one model and should not enter the
project-wide namespace.
Where private values work
A model-private value is available in:- The owning model’s query
- Inline SQL hooks written in that model
- Another model
- A child or sibling model directory
- A unit test or scenario
- A named SQL hook stored under
hooks/sql/
_. Names beginning with __ are reserved for SQLBuild.
Because the model owns the name, different models may each define _state without creating a
collision.
Explicit types and rendering
Useconstant(...) when a private constant needs an exact type or rendering choice:
When a value becomes shared
Move the declaration out ofMODEL() when another resource needs it. Remove the _ prefix and put
it in the narrowest suitable enum or constant directory. See
Declarations and Scopes for those advanced placement options.
