Declaration
Class: Declaration
Section titled “Class: Declaration”You can declare any external table as a data source in sqlanvil. Declaring external data sources that are external to sqlanvil lets you treat those data sources as sqlanvil 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 sqlanvil.
- View declared sources in the visualized sqlanvil graph.
- Use sqlanvil 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.sqlxconfig { type: "declaration"}-- Note: no SQL should be present.Using action configs files:
actions:- declare: name: nameUsing the Javascript API:
declare("name")Naming the declaration:
A declaration’s name must match the existing table it points at. In a SQLX file it defaults to the
file’s name: definitions/name.sqlx declares a table called name. Set name in the config when
the file is named differently from the table. Other actions then ref() it by that name:
-- definitions/sources/app_customers.sqlxconfig { type: "declaration", schema: "app", name: "customers"}An action configs file or the Javascript API has no filename to default to, so name is
required there.
Hierarchy
Section titled “Hierarchy”-
ActionBuilder‹Declaration›
↳ Declaration
Methods
Section titled “Methods”Methods
Section titled “Methods”columns
Section titled “columns”▸ 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
Section titled “description”▸ description(description: string): this
deprecated Deprecated in favor of
DeclarationConfig.description.
Sets the description of this assertion.
Parameters:
| Name | Type |
|---|---|
description | string |
Returns: this