IF Commons GitHub

sql/extensions/transforms/model

Written to: 4 requirements: 4 proved, 0 partly, 0 failing, 0 with no test recorded. 0023-sql-transforms FR-001, 0023-sql-transforms FR-002, 0023-sql-transforms FR-003, 0023-sql-transforms FR-005

A project of transforms (commons data 0023-sql-transforms): models whose SQL asks for the tables of a schema and one another by the words of their names, put in the order of what they ask for, with their tests as SQL and their lineage.

Source: commons/data/sql/extensions/transforms/model.ts

4 of 8 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Materializationtypeno test imports it
type Materialization = "view" | "table" | "incremental" | "ephemeral";

How a model's result is kept.

Modelinterfaceno test imports it
interface Model

A model, resolved.

MemberTypeWhat it is
namestring
refstringThe reference to it, written and qualified.
schemastring | undefined
tablestring
materializationMaterialization
keyreadonly string[]
sqlstring
hashstringThe hash of what defines it: its SQL, how it is kept and its key.
readsreadonly string[]What its SQL asks for, by the words of their names.
testsreadonly ResolvedTest[]
ModelSpecinterface
interface ModelSpec

What a project says of a model.

MemberTypeWhat it is
namestring
select(refs: Refs) => stringThe model's SQL, given the references of the schema and of the other models.
materialization?Materializationview where it is not said.
key?readonly string[]The columns a row of an incremental model is known by, as its SQL names them.
tests?readonly Check[]

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

Projectinterface
interface Project

A project of models, in the order they build.

MemberTypeWhat it is
modelsreadonly Model[]
lineagereadonly LineageEdge[]
dialectDialect
namingNaming
settingsTransforms
ledger{ readonly ref: string; readonly schema: string | undefined; readonly table: string; }The ledger's table.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

ResolvedTestinterfaceno test imports it
interface ResolvedTest

A test as SQL.

MemberTypeWhat it is
namestring
kind"accepted-values" | "custom" | "not-null" | "relationship" | "unique"
severity"error" | "warn"
failingstring
TransformErrortypeno test imports it
type TransformError =
  | RefError
  | { readonly kind: "duplicate"; readonly name: string }
  | { readonly kind: "cycle"; readonly models: readonly string[] }
  | { readonly kind: "no-key"; readonly model: string }
  | { readonly kind: "ephemeral-test"; readonly model: string };

Why a transform cannot be defined or applied, as a value.

TransformOptionsinterface
interface TransformOptions

What a project is made with.

MemberTypeWhat it is
dialectDialect
naming?Naming
schema?stringThe schema the tables are in, as bind was given it.
settings?TransformSettings

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

transformerfunction
function transformer(schema: LogicalSchema, specs: readonly ModelSpec[], options: TransformOptions): Result<Project, readonly TransformError[]>

A project of models.

ParameterWhat it is
schemathe logical schema
specsthe models
optionsthe dialect, naming, the tables' schema and the settings

Returns: the project, or why not

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.