Skip to content

Latest commit

 

History

History
280 lines (175 loc) · 6.6 KB

File metadata and controls

280 lines (175 loc) · 6.6 KB

Dataform Javascript API ReferenceGlobals"core/actions/operation"Operation

Class: Operation

Operations define custom SQL operations that don't fit into the Dataform model of publishing a table or writing an assertion.

You can create operations in the following ways. Available config options are defined in OperationConfig, and are shared across all the following ways of creating operations.

Using a SQLX file:

-- definitions/name.sqlx
config {
  type: "operations"
}
DELETE FROM dataset.table WHERE country = 'GB'

Using action configs files:

# definitions/actions.yaml
actions:
- operation:
  filename: name.sql
-- definitions/name.sql
DELETE FROM dataset.table WHERE country = 'GB'

Using the Javascript API:

// definitions/file.js
operate("name").query("DELETE FROM dataset.table WHERE country = 'GB'")

Note: When using the Javascript API, methods in this class can be accessed by the returned value. This is where query comes from.

Hierarchy

  • ActionBuilder‹Operation›

    Operation

Index

Methods

Methods

columns

columns(columns: ColumnDescriptor[]): this

deprecated Deprecated in favor of OperationConfig.columns.

Sets the column descriptors of columns in this table.

Parameters:

Name Type
columns ColumnDescriptor[]

Returns: this


database

database(database: string): this

deprecated Deprecated in favor of OperationConfig.project.

Sets the database (Google Cloud project ID) in which to create the corresponding view for this operation.

Parameters:

Name Type
database string

Returns: this


dependencies

dependencies(value: Resolvable | Resolvable[]): this

deprecated Deprecated in favor of OperationConfig.dependencies.

Sets dependencies of the table.

Parameters:

Name Type
value Resolvable | Resolvable[]

Returns: this


description

description(description: string): this

deprecated Deprecated in favor of OperationConfig.description.

Sets the description of this assertion.

Parameters:

Name Type
description string

Returns: this


disabled

disabled(disabled: boolean): this

deprecated Deprecated in favor of OperationConfig.disabled.

If called with true, this action is not executed. The action can still be depended upon. Useful for temporarily turning off broken actions.

Parameters:

Name Type Default
disabled boolean true

Returns: this


hasOutput

hasOutput(hasOutput: boolean): this

deprecated Deprecated in favor of OperationConfig.hasOutput.

Declares that this action creates a dataset which should be referenceable as a dependency target, for example by using the ref function.

Parameters:

Name Type
hasOutput boolean

Returns: this


hermetic

hermetic(hermetic: boolean): void

deprecated Deprecated in favor of OperationConfig.hermetic.

If true, this indicates that the action only depends on data from explicitly-declared dependencies. Otherwise if false, it indicates that the action depends on data from a source which has not been declared as a dependency.

Parameters:

Name Type
hermetic boolean

Returns: void


queries

queries(queries: ContextableIActionContext, string | string[]›): this

Sets the query/queries to generate the operation from.

Parameters:

Name Type
queries ContextableIActionContext, string | string[]›

Returns: this


schema

schema(schema: string): this

deprecated Deprecated in favor of OperationConfig.dataset.

Sets the schema (BigQuery dataset) in which to create the output of this action.

Parameters:

Name Type
schema string

Returns: this


setDependOnDependencyAssertions

setDependOnDependencyAssertions(dependOnDependencyAssertions: boolean): this

deprecated Deprecated in favor of OperationConfig.dependOnDependencyAssertions.

When called with true, assertions dependent upon any dependency will be add as dedpendency to this action.

Parameters:

Name Type
dependOnDependencyAssertions boolean

Returns: this


tags

tags(value: string | string[]): this

deprecated Deprecated in favor of OperationConfig.tags.

Sets a list of user-defined tags applied to this action.

Parameters:

Name Type
value string | string[]

Returns: this