Dataform Javascript API Reference › Globals › "core/actions/declaration" › Declaration
You can declare any BigQuery table as a data source in Dataform. Declaring BigQuery data sources that are external to Dataform lets you treat those data sources as Dataform objects.
Declaring data sources is optional, but can be useful when you want to do the following:
- Reference or resolve declared sources in the same way as any other table in Dataform.
- View declared sources in the visualized Dataform graph.
- Use Dataform to manage the table-level and column-level descriptions of externally created tables.
- Trigger workflow invocations that include all the dependents of an external data source.
You can create declarations in the following ways. Available config options are defined in DeclarationConfig, and are shared across all the followiing ways of creating declarations.
Using a SQLX file:
-- definitions/name.sqlx
config {
type: "declaration"
}
-- Note: no SQL should be present.Using action configs files:
# definitions/actions.yaml
actions:
- declare:
name: nameUsing the Javascript API:
// definitions/file.js
declare("name")-
ActionBuilder‹Declaration›
↳ Declaration
▸ columns(columns: ColumnDescriptor[]): this
deprecated Deprecated in favor of
DeclarationConfig.columns.
Sets the column descriptors of columns in this table.
Parameters:
| Name | Type |
|---|---|
columns |
ColumnDescriptor[] |
Returns: this
▸ description(description: string): this
deprecated Deprecated in favor of
DeclarationConfig.description.
Sets the description of this assertion.
Parameters:
| Name | Type |
|---|---|
description |
string |
Returns: this