Tables reference

A table defines a table, or view that will be created in your data warehouse.

For examples and usage, check out the tables guide.

ref()

Returns the full, query-able name of the referenced table, and adds the table to dependencies.

ref(tableName)

Arguments

FieldTypeDescription
tableNamestringThe name of the table to reference

self()

Returns the full, query-able name of the current table

self()

dependencies()

Specifies one or more tables, operations or assertions that this node depends on. Supports wildcard matches with "*".

dependencies(deps)

Arguments

FieldTypeDescription
depsstring | string[]Either a single dependency name, or a list

type()

Set the type of the table. View the table guide for more info.

type(name)

Arguments

FieldTypeDescription
name"view" | "table" | "incremental"The type of the table

where()

Sets a where clause that is used for incremental tables.

where(clause)

Arguments

FieldTypeDescription
clauseContextable<string>The where clause. Can be a string or a context function.

protected()

A incremental table marked protected will never be rebuilt from scratch.

protected()

disabled()

Disable this action from being run.

disabled()

preOps()

Provide one of more queries to execute before this table is created.

preOps(ops)

Arguments

FieldTypeDescription
opsContextable<string | string[]>The queries to run

postOps()

Provide one of more queries to execute after this table has completed.

postOps(ops)

Arguments

FieldTypeDescription
opsContextable<string | string[]>The queries to run

describe()

Adds a field to the table descriptor with the given description (optional), and returns the field name.

describe(field, description?)

Arguments

FieldTypeDescription
fieldstringThe field name
descriptionstringThe field description

descriptor()

Sets the descriptor for fields in this table.

descriptor(fields)
descriptor(field, description)
descriptor(descriptor)

Arguments

FieldTypeDescription
fieldsstring[]A list of field names
fieldstringThe field name
descriptionstringThe field description
descriptor{[field: string]: string}A map of field names to field descriptions

config()

Sets several properties of the table at once.

config(config)

Arguments

FieldTypeDescription
configTableConfigThe configuration object