## Node.to_substrait()


The node's verified plan for any conforming Substrait consumer,


Usage

``` python
Node.to_substrait(
    format="json",
    *,
    shims="apply",
)
```


with its contract as metadata: [Report.to_substrait](Report.to_substrait.md#sverify.Report.to_substrait) of [report](Node.report.md#sverify.Node.report).

The plan is the last transform's: it reads a contracted node upstream as a table under that transform's name, and the contract's `requires` on it are what that node guarantees. Export each node of a pipeline for the whole of it. [internal_plan](Node.internal_plan.md#sverify.Node.internal_plan) is the fused stage in sverify's internal form.


## Parameters


`format: Literal[``"json", `<span class="st">`"binary"``]`</span>` = ``"json"`  
`"json"` (protobuf JSON, a string) or `"binary"` (the serialized `substrait.Plan`).

`shims: Literal[``"apply", `<span class="st">`"annotate"``, ``"refuse"``]`</span>` = ``"apply"`  
What to do at a spec gap the proof depends on (see [Report.to_substrait](Report.to_substrait.md#sverify.Report.to_substrait)).


## Returns


`str | bytes`  
The plan, as protobuf JSON or bytes.


## Raises


`sverify.errors.ExportError`  
The node has no contract (a source, or a plain function's node), its report is not proved, or the plan has no conforming Substrait form that keeps the proof.
