Skip to main content

Module python_snippet

Module python_snippet 

Source
Expand description

Renders an “equivalent Python schema declaration” snippet for one MigrationStep — shown alongside the DDL preview in the interactive migration CLI, since Pylon has no separate SDL the way some other schema-migration tools do, and DDL alone is less immediately readable than the Python declaration it corresponds to.

Best-effort and display-only: covers the common cases (scalar/enum creation, object-type and interface-type creation with the full pointer list, object-type alteration — which also shows the full current pointer list, not just the changed ones, since a step’s MigrationStep doesn’t carry a “before” shape to diff against here — and functions, shown as their original PyQL body rather than the compiled SQL a function’s DDL preview otherwise shows, since PyQL’s compiled form is a deeply nested CTE tree that reads nothing like what the user actually wrote) and is not meant to be round-trippable. The actual .py schema file stays authoritative.

Functions§

python_snippet_for_step
None for step kinds this renderer doesn’t cover yet (modules — see the module doc comment).