On this page
SQL transform (sql)¶
Runs a SQL query over the source view(s) and emits a @dp.temporary_view.
Requires exactly one of sql or sql_path.
Minimal example¶
Add this entry to the actions list in your flowgroup.
- name: transform_orders
type: transform
transform_type: sql
source: v_orders_raw
target: v_orders
sql: "SELECT * FROM v_orders_raw WHERE amount > 0"
Options¶
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string / list |
Yes |
— |
Input view name(s). |
|
string |
Cond. |
— |
Inline SQL query. Exactly one of |
|
string |
Cond. |
— |
Path to an external |
Substitution tokens (${token}, ${secret:scope/key}) are resolved in both
inline SQL and external files. A plain ${name} that is still in the
sql_path file after substitution fails lhp validate and lhp generate
with LHP-CFG-010. Dotted or prefixed Spark variables such as
${mypipeline.start} or ${hiveconf:x} are left as written.
To read a pipeline configuration: parameter at runtime, give it a dotted
key (for example mypipeline.start_date) and reference it as
${mypipeline.start_date}; a plain ${start_date} fails even when the
configuration defines it.
Wrap a source in stream(view_name) inside the query to read it as a stream.
In a template action, a sql_path file that contains {{, {% or
{# is rendered with the template parameters before substitution, like the
template’s inline SQL. See Parameters in SQL files.
Common fields¶
Fields accepted by every transform_type. Type-specific fields are listed in
the options above.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Action name, unique within the flowgroup. |
|
string |
Yes |
— |
Always |
|
string |
Yes |
— |
One of |
|
string |
Yes |
— |
Name of the produced view (or temporary table). Required for all transforms. |
|
string / list / mapping |
Yes |
— |
Upstream view name(s). Accepted shape and requirement vary per type — see this type’s options. |
|
string |
No |
auto |
Comment on the generated view/table. Defaults to an auto-generated string. |
|
bool / list |
No |
— |
Add operational metadata columns; a list selects column names. Honored by |
|
list |
No |
— |
Extra upstream table or view references added to the dependency graph. See Dependency analysis reference. |