Skip to main content

Node.to_sql()

The node’s stage as SQL, in dialect: what refresh runs for a

Usage

Source

Node.to_sql(dialect="duckdb")

full recompute, with every run-time check, and the meaning the proof gives it. Windows of a deterministic report need no row-order tiebreak (Report.to_sql).

The SQL reads the sources and stored nodes upstream by their names (internal_plan). A node whose contract is not proved is refused, as refresh refuses it; a node without a contract (a source, or a plain function’s result) has no proof to check.

Parameters

dialect: Any = "duckdb"
"duckdb" (the default), "snowflake" or "spark", or one of sverify.engines.DUCKDB, SNOWFLAKE and SPARK.

Returns

str
One SQL query.

Raises

ValueError

dialect is unknown.

sverify.errors.UnverifiedRunError

The node’s contract is not proved.

sverify.errors.RouteError

No route takes the plan to the dialect’s engine.

sverify.errors.Unsupported
The dialect cannot express the plan.

Examples

node = orders.pipe(paid)
print(node.to_sql("snowflake"))