Skip to content

Generate Curated

POST
/api/v2/codegen/curated
curl --request POST \
--url https://example.com/api/v2/codegen/curated \
--header 'Content-Type: application/json' \
--data '{ "flow_name": "example", "source_table": "example", "source_tables": [ "example" ], "target_name": "example", "trigger_type": "scheduled", "schedule": { "cron": "example", "timezone": "UTC" }, "sql": "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" } ] }, "load_options": { "truncate": false, "merge": false, "dedup_columns": [ "example" ], "dedup_order_by": "example" }, "audit_columns": { "additionalProperty": "example" }, "warehouse": "example", "requested_by": "example" }'

Generate Curated (Silver) layer artifacts - V2.

This is the simplified curated layer generation that:

  • Requires SQL in input (SELECT, INSERT, or procedure call)
  • trigger_type: “scheduled” or “streaming” only
  • Template selection based on SQL content:
    • SELECT → INSERT or TRUNCATE+INSERT (based on load_options.truncate)
    • INSERT → used as-is
    • Procedure → wrapped in procedure template
  • For streaming: creates Dynamic Table

Response contains:

  • DDL artifact at sql/ddl/{flow_name}.sql
  • SQL artifact at sql/silver/{flow_name}.sql
  • Task SQL at sql/tasks/{flow_name}_task.sql (scheduled only)
  • Changelog at docs/changelog/silver_{flow_name}.md
X-Environment-Id
Any of:
string
Media typeapplication/json
SilverFlowInput

Input model for Silver layer code generation.

Simplified model focused on silver layer with:

  • trigger_type: Only “scheduled” or “streaming”
  • sql: Always required (contains SELECT, INSERT, or procedure call)

Template selection is based on sql content:

  • SELECT statement → wrapped in INSERT/TRUNCATE+INSERT
  • INSERT statement → used directly
  • CALL/procedure → wrapped in procedure template

Example payload: { “flow_name”: “silver_customer”, “source_table”: “dev.raw.customer”, “target_name”: “dev.silver.customer”, “trigger_type”: “scheduled”, “schedule”: {“cron”: “USING CRON 0 * * * * UTC”, “timezone”: “UTC”}, “sql”: “SELECT customer_id, TRIM(name) as name FROM dev.raw.customer”, “target_schema”: { “description”: “Customer dimension”, “columns”: [ {“name”: “customer_id”, “type”: “STRING”, “pk”: true}, {“name”: “name”, “type”: “STRING”} ] }, “load_options”: {“truncate”: true}, “warehouse”: “COMPUTE_WH”, “requested_by”: “user” }

object
flow_name
required
Flow Name
string
source_table
Any of:
string
source_tables
Any of:
Array<string>
target_name
required
Target Name
string
trigger_type
required
Trigger Type
string
Allowed values: scheduled streaming
schedule
Any of:
ScheduleConfig

Schedule configuration for tasks.

object
cron
required
Cron
string
timezone
Timezone
string
default: UTC
sql
required
Sql
string
target_schema
required
TableSchema

Table schema definition.

object
description
required
Description
string
columns
required
Columns
Array<object>
ColumnSchema

Column definition for table schemas.

object
name
required
Name
string
type
required
Type
string
description
Any of:
string
pk
Pk
boolean
not_null
Not Null
boolean
pii
Pii
boolean
glossary_terms
Glossary Terms
Array<string>
foreign_keys
Foreign Keys
Array<object>
ForeignKey

Foreign key definition.

object
column
required
Column
string
parent_table
required
Parent Table
string
parent_column
required
Parent Column
string
load_options
Any of:
LoadOptions

Load options for declarative ETL.

object
truncate
Truncate
boolean
merge
Merge
boolean
dedup_columns
Any of:
Array<string>
dedup_order_by
Any of:
string
audit_columns
Any of:
object
key
additional properties
string
warehouse
Any of:
string
requested_by
required
Requested By
string

Successful Response

Media typeapplication/json
CodegenResponse

Standard response for all codegen endpoints.

object
status
Status
string
default: success
Allowed values: success error
artifacts
required
Artifacts
Array<object>
ArtifactOutput

Standard artifact output format.

object
path
required
Path
string
content
required
Content
string
file_type
Any of:
string
is_base64
Is Base64
boolean
metadata
Any of:
object
key
additional properties
any
errors
Errors
Array<string>
Example
{
"status": "success",
"artifacts": [
{
"is_base64": false
}
]
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}