Skip to main content
Put an enum or constant directly in 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
It is not available in:
  • Another model
  • A child or sibling model directory
  • A unit test or scenario
  • A named SQL hook stored under hooks/sql/
Private names begin with exactly one _. 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

Use constant(...) when a private constant needs an exact type or rendering choice:

When a value becomes shared

Move the declaration out of MODEL() 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.