Return a unified textual diff of the original plan versus the revised plan.
The diff compares the two plans’ code line by line, in the format used by git diff and code review tools (lines starting with - were removed and lines starting with + were added). It’s the quickest way to see an edit in context, but it’s sensitive to formatting: a step that was only reformatted shows up as changed. For a list of the changed steps that ignores formatting, use changed_steps().
Returns
str
-
The diff as a single string, which is empty when the two plans have the same code.
Examples
import pointblank as pb
small_table = pb.load_dataset("small_table")
edit = pb.EditValidation.from_plans(
pb.Validate(data=small_table).col_vals_gt(columns="d", value=100),
(
pb.Validate(data=small_table)
.col_vals_gt(columns="d", value=50)
.col_vals_not_null(columns="a")
),
)
print(edit.diff())
--- original_plan.py
+++ edited_plan.py
@@ -4,7 +4,8 @@
pb.Validate(
data=your_data, # Replace your_data with the actual data variable
)
- .col_vals_gt(columns="d", value=100)
+ .col_vals_gt(columns="d", value=50)
+ .col_vals_not_null(columns="a")
)
validation
The old col_vals_gt() line is replaced by one with value=50, and a col_vals_not_null() line is added. The two files in the header (original_plan.py and edited_plan.py) are only labels, and nothing is written to disk.