A model contract checks the declared output shape, including column names and types, when the adapter supports it. Constraints add storage-level guarantees where supported, while data tests query the built records.
They serve related purposes, but a test and a contract run at different points and shouldn't be treated as interchangeable. Explicitly cast a field when the required type matters.
Hooks execute SQL around a model build. A pre-hook runs before the materialization, and a post-hook runs after it. Use them for narrowly scoped warehouse operations with understood permissions and failure behavior.
A hook is code with side effects, so make replay safe where possible. This simulator demonstrates execution locally inside DuckDB; it doesn't grant production permissions. These tasks keep the model result simple so you can focus on the ordering and the guarantee being declared.