Generate Declarative
const url = 'https://example.com/api/v1/codegen/declarative';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"flow_name":"example","target_layer":"silver","source_table":"example","source_tables":["example"],"target_name":"example","trigger_type":"scheduled","schedule":{"cron":"example","timezone":"UTC"},"sequence_column":"example","target_schema":{"description":"example","columns":[{"name":"example","type":"example","description":"","pk":false,"not_null":false,"pii":false,"glossary_terms":["example"]}],"foreign_keys":[{"column":"example","parent_table":"example","parent_column":"example"}]},"sql":"example","rename_columns":{"additionalProperty":"example"},"transform_columns":{"additionalProperty":{"cast":"example"}},"filters":[{"column":"example","operator":"=","value":["example"]}],"load_options":{"truncate":false,"merge":false,"dedup_columns":["example"],"dedup_order_by":"example"},"audit_columns":{"additionalProperty":"example"},"cluster_by":["example"],"table_properties":{"additionalProperty":"example"},"warehouse":"example","requested_by":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/codegen/declarative \ --header 'Content-Type: application/json' \ --data '{ "flow_name": "example", "target_layer": "silver", "source_table": "example", "source_tables": [ "example" ], "target_name": "example", "trigger_type": "scheduled", "schedule": { "cron": "example", "timezone": "UTC" }, "sequence_column": "example", "target_schema": { "description": "example", "columns": [ { "name": "example", "type": "example", "description": "", "pk": false, "not_null": false, "pii": false, "glossary_terms": [ "example" ] } ], "foreign_keys": [ { "column": "example", "parent_table": "example", "parent_column": "example" } ] }, "sql": "example", "rename_columns": { "additionalProperty": "example" }, "transform_columns": { "additionalProperty": { "cast": "example" } }, "filters": [ { "column": "example", "operator": "=", "value": [ "example" ] } ], "load_options": { "truncate": false, "merge": false, "dedup_columns": [ "example" ], "dedup_order_by": "example" }, "audit_columns": { "additionalProperty": "example" }, "cluster_by": [ "example" ], "table_properties": { "additionalProperty": "example" }, "warehouse": "example", "requested_by": "example" }'Generate declarative ETL artifacts for Silver or Gold layer.
The target_layer field determines which layer templates are used:
- “silver”: For silver layer transformations
- “gold”: For gold layer with optional MERGE support
Load modes (via load_options):
- Default: INSERT (append)
- truncate=True: TRUNCATE + INSERT
- merge=True: MERGE/upsert (requires primary_keys)
Execution modes:
- scheduled: Creates Task SQL with schedule_cron
- streaming: Creates Dynamic Table
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Unified input model for declarative ETL code generation. Supports both Silver and Gold layers with the same input structure as CuratedFlowInput.
Example payload: { “flow_name”: “silver_customer”, “target_layer”: “silver”, “source_table”: “dev.raw.customer”, “target_name”: “dev.silver.customer”, “trigger_type”: “scheduled”, “schedule”: {“cron”: “USING CRON 0 * * * * UTC”, “timezone”: “UTC”}, “target_schema”: { “description”: “Customer dimension”, “columns”: [ {“name”: “customer_id”, “type”: “STRING”, “pk”: true}, {“name”: “email”, “type”: “STRING”, “pii”: true} ] }, “warehouse”: “COMPUTE_WH”, “requested_by”: “user” }
object
Schedule configuration for tasks.
object
Table schema definition.
object
Foreign key definition.
object
object
Cast transformation specification.
object
Target data type for CAST, e.g. TIMESTAMP_NTZ, VARCHAR, INTEGER
Filter condition for WHERE clause.
object
Load options for declarative ETL.
object
Responses
Section titled “Responses”Successful Response
Standard response for all codegen endpoints.
object
Example
{ "status": "success", "artifacts": [ { "is_base64": false } ]}Validation Error
object
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}