Skip to main content

submit_spark_sql(options)

Submit a Spark SQL query that writes its result to an Iceberg output table. Returns run info immediately; use get_run() or submit_spark_sql_and_wait() to poll status.

Parameters

options.namespace
str
required
Job namespace.
options.name
str
required
Job name.
options.query
str
required
The Spark SQL query to execute.
options.output_table
str
required
The Iceberg table the query result is written to.
options.write_mode
SparkWriteMode
default:"OVERWRITE"
OVERWRITE or APPEND. Case-insensitive on input.
options.driver_machine_type
SparkMachineType
default:"spark.1.b"
Driver machine type.
options.executor_machine_type
SparkMachineType
default:"spark.1.b"
Executor machine type.
options.executor_numbers
int
default:"2"
Number of executors, from 1 to 20.

Return type: SparkSqlSubmitResponse

FieldTypeDescription
run_idstrThe ID of the submitted run
statestrInitial run state (for example, SUBMITTED)
namespacestrJob namespace
job_namestrJob name
pipeline_idOptional[str]Pipeline ID if one exists
submitted_atstrISO timestamp of submission
computeSparkSqlComputedriver_machine_type, executor_machine_type, executor_numbers
output_tablestrThe output table
write_modestrThe write mode used

submit_spark_sql_and_wait(options)

Submit a Spark SQL query and poll until the run reaches a terminal state (COMPLETE, FAIL, or ABORT). Raises TimeoutError if the timeout is exceeded.
Accepts all submit_spark_sql options plus:
options.poll_interval_ms
int
default:"10000"
Milliseconds between status polls. Must be greater than 0.
options.timeout_ms
int
default:"600000"
Maximum time to wait in milliseconds before raising TimeoutError.

Return type: SubmitAndWaitResult

FieldTypeDescription
run_idstrThe ID of the submitted run
statestrTerminal state (COMPLETE, FAIL, or ABORT)
runRunResponseFull run details