Documentation
¶
Overview ¶
Package model reads one `.sql` file as a model: a header, a query, and the name the two of them make.
THE CONFIG IS A COMMENT, so the file stays valid SQL. It opens in an editor with highlighting, it runs in a console by hand, and `psql -f` executes it. That is the whole reason the header is not front matter: a model you cannot paste into a client is a model you debug twice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Materialisation ¶
type Materialisation string
Materialisation is what a model becomes in the warehouse.
const ( View Materialisation = "view" Table Materialisation = "table" )
type Model ¶
type Model struct {
// Schema and Name come from the PATH and never from the header:
// `models/<schema>/<name>.sql` is `<schema>.<name>`. Two places to say
// where a model lands is one place for them to disagree.
Schema string
Name string
Materialised Materialisation
Tests []Test
// DependsOn is the explicit override for an edge the extractor cannot
// see -- SQL built at runtime, or one of the forms refs names as its
// limits. Added to what was inferred, never instead of it.
DependsOn []string
// SQL is the query with the header still in it. The header is a comment,
// so the warehouse ignores it and the file that ran is the file on disk.
SQL string
}
Model is one file, read.
Click to show internal directories.
Click to hide internal directories.