API Reference

IAssertionConfig

Configuration options for assertion action types.

database
string

The database where the corresponding view for this assertion should be created.

dependencies
Resolvable | Resolvable[]

One or more explicit dependencies for this action. Dependency actions will run before dependent actions. Typically this would remain unset, because most dependencies are declared as a by-product of using the ref function.

description
string

A description for this assertion.

schema
string

The schema where the corresponding view for this assertion should be created.

tags
string[]

A list of user-defined tags with which the action should be labeled.

IAssertionContext

Context methods are available when evaluating contextable SQL code, such as within SQLX files, or when using a Contextable argument with the JS API.

name
() => string

Returns the name of this dataset.

ref
(ref: Resolvable | string[], rest: string[]) => string

References another action, adding it as a dependency to this action, returning valid SQL to be used in a from expression.

This function can be called with a Resolvable object, for example:

${ref({ name: "name", schema: "schema", database: "database" })}

This function can also be called using individual arguments for the "database", "schema", and "name" values. When only two values are provided, the default database will be used and the values will be interpreted as "schema" and "name". When only one value is provided, the default data base schema will be used, with the provided value interpreted as "name".

${ref("database", "schema", "name")}
${ref("schema", "name")}
${ref("name")}
resolve
(ref: Resolvable | string[], rest: string[]) => string

Similar to ref except that it does not add a dependency, but just resolves the provided reference so that it can be used in SQL, for example in a from expression.

See the ref function for example usage.

self
() => string

Equivelant to resolve(name()).

Returns a valid SQL string that can be used to reference the dataset produced by this action.

IColumnsDescriptor

Describes columns in a dataset.

{ [name]: string | IRecordDescriptor }

IRecordDescriptor

Describes a struct, object or record in a dataset that has nested columns.

columns
IColumnsDescriptor

A description of columns within the struct, object or record.

description
string

A description of the struct, object or record.

ITarget

A reference to a dataset within the warehouse.

database
string
name
string
schema
string

Contextable

Contextable arguments can either pass a plain value for their generic type T or can pass a function that will be called with the context object for this type of operation.

T | (ctx: Context) => T

Resolvable

A resolvable can be either the name of a dataset as string, or an object that describes the full path to the relation.

string | ITarget

IDeclarationConfig

Configuration options for declaration action types.

columns
IColumnsDescriptor

A description of columns within the dataset.

database
string

The database in which the output of this action should be created.

description
string

A description of the dataset.

schema
string

The schema in which the output of this action should be created.

tags
string[]

A list of user-defined tags with which the action should be labeled.

IOperationConfig

Configuration options for operations action types.

columns
IColumnsDescriptor

A description of columns within the dataset.

database
string

The database in which the output of this action should be created.

dependencies
Resolvable | Resolvable[]

One or more explicit dependencies for this action. Dependency actions will run before dependent actions. Typically this would remain unset, because most dependencies are declared as a by-product of using the ref function.

description
string

A description of the dataset.

hasOutput
boolean

Declares that this operations action creates a dataset which should be referenceable using the ref function.

If set to true, this action should create a dataset with its configured name, using the self() context function.

For example:

create or replace table ${self()} as select ...
schema
string

The schema in which the output of this action should be created.

tags
string[]

A list of user-defined tags with which the action should be labeled.

IOperationContext

Context methods are available when evaluating contextable SQL code, such as within SQLX files, or when using a Contextable argument with the JS API.

name
() => string

Returns the name of this dataset.

ref
(ref: Resolvable | string[], rest: string[]) => string

References another action, adding it as a dependency to this action, returning valid SQL to be used in a from expression.

This function can be called with a Resolvable object, for example:

${ref({ name: "name", schema: "schema", database: "database" })}

This function can also be called using individual arguments for the "database", "schema", and "name" values. When only two values are provided, the default database will be used and the values will be interpreted as "schema" and "name". When only one value is provided, the default data base schema will be used, with the provided value interpreted as "name".

${ref("database", "schema", "name")}
${ref("schema", "name")}
${ref("name")}
resolve
(ref: Resolvable | string[], rest: string[]) => string

Similar to ref except that it does not add a dependency, but just resolves the provided reference so that it can be used in SQL, for example in a from expression.

See the ref function for example usage.

self
() => string

Equivelant to resolve(name()).

Returns a valid SQL string that can be used to reference the dataset produced by this action.

IBigQueryOptions

Options for creating tables within BigQuery projects.

partitionBy
string

The key with which to partition the table. Typically the name of a timestamp or date column.

For more information, read the BigQuery partitioned tables docs.

IRedshiftOptions

Redshift specific warehouse options.

bind
boolean

By default, views are created as late binding views.

When this is set to true, views will not be created as late binding views, and the WITH SCHEMA BINDING suffix is omitted.

For more information, read the Redshift create view docs.

distKey
string

Sets the DISTKEY property when creating tables.

For more information, read the Redshift create table docs.

distStyle
string

Set the DISTSTYLE property when creating tables.

For more information, read the Redshift create table docs.

sortKeys
string[]

A list of string values that will configure the SORTKEY property when creating tables.

For more information, read the Redshift create table docs.

sortStyle
string

Sets the style of the sort key when using sort keys.

For more information, read the Redshift sort style article.

ISQLDataWarehouseOptions

Options for creating tables within Azure SQL Data Warehouse projects.

distribution
string

The distribution option value.

For more information, read the Azure CTAS docs.

ITableConfig

Configuration options for dataset actions, including table, view and incremental action types.

bigquery
IBigQueryOptions

BigQuery-specific warehouse options.

columns
IColumnsDescriptor

A description of columns within the dataset.

database
string

The database in which the output of this action should be created.

dependencies
Resolvable | Resolvable[]

One or more explicit dependencies for this action. Dependency actions will run before dependent actions. Typically this would remain unset, because most dependencies are declared as a by-product of using the ref function.

description
string

A description of the dataset.

disabled
boolean

If set to true, this action will not be executed. However, the action may still be depended upon. Useful for temporarily turning off broken actions.

protected
boolean

Only allowed when the table type is incremental.

If set to true, running this action will ignore the full-refresh option. This is useful for tables which are built from transient data, to ensure that historical data is never lost.

redshift
IRedshiftOptions

Redshift-specific warehouse options.

schema
string

The schema in which the output of this action should be created.

sqldatawarehouse
ISQLDataWarehouseOptions

Azure SQL Data Warehouse-specific options.

tags
string[]

A list of user-defined tags with which the action should be labeled.

type
TableType

The type of the dataset. For more information on how this setting works, check out some of the guides on publishing different types of datasets with Dataform.

ITableContext

Context methods are available when evaluating contextable SQL code, such as within SQLX files, or when using a Contextable argument with the JS API.

incremental
() => boolean

Indicates whether the config indicates the file is dealing with an incremental table.

name
() => string

Returns the name of this dataset.

ref
(ref: Resolvable | string[], rest: string[]) => string

References another action, adding it as a dependency to this action, returning valid SQL to be used in a from expression.

This function can be called with a Resolvable object, for example:

${ref({ name: "name", schema: "schema", database: "database" })}

This function can also be called using individual arguments for the "database", "schema", and "name" values. When only two values are provided, the default database will be used and the values will be interpreted as "schema" and "name". When only one value is provided, the default data base schema will be used, with the provided value interpreted as "name".

${ref("database", "schema", "name")}
${ref("schema", "name")}
${ref("name")}
resolve
(ref: Resolvable | string[], rest: string[]) => string

Similar to ref except that it does not add a dependency, but just resolves the provided reference so that it can be used in SQL, for example in a from expression.

See the ref function for example usage.

self
() => string

Equivelant to resolve(name()).

Returns a valid SQL string that can be used to reference the dataset produced by this action.

when
(cond: boolean, trueCase: string, falseCase: string) => string

Shorthand for an if condition. Equivalent to cond ? trueCase : falseCase. falseCase is optional, and defaults to an empty string.

DistStyleType

Valid types for setting the distribution style for Redshift tables.

View the Redshift documentation for more information.

"even" | "key" | "all"

SortStyleType

Valid types for setting the sort style for Redshift tables.

View the Redshift documentation for more information.

"compound" | "interleaved"

TableType

Supported types of table actions.

Tables of type view will be created as views.

Tables of type table will be created as tables.

Tables of type incremental must have a where clause provided. For more information, see the incremental tables guide.

"table" | "view" | "incremental" | "inline"

ITestConfig

Configuration options for unit tests.

dataset
Resolvable

The dataset that this unit test tests.