@@ -70,7 +70,7 @@ considered optional. Put another way, you can set various thresholds and various
7070and the interrogation phase will determine whether all the requirements are met for executing
7171an action.
7272
73- ## Ways to Express Actions: Text or Custom Functions
73+ ## Expressing Actions with a String
7474
7575There are a few options in how to define the actions:
7676
@@ -99,7 +99,6 @@ Here's an example where we prepare a console message with a number of value plac
9999(` action_str ` ) and use it globally at ` Actions(critical=) ` :
100100
101101``` {python}
102-
103102action_str = "[{LEVEL}: {TYPE}]: Step {step} has failed validation. ({time})"
104103
105104validation_2 = (
@@ -123,15 +122,18 @@ resulting text is capitalized (e.g., `"CRITICAL"`, `"COL_VALS_GT"`, etc.) and th
123122capitalized the placeholder text itself. Have a look at the documentation article of
124123[ ` Actions ` ] ( https://posit-dev.github.io/pointblank/reference/Actions.html ) for more details on this.
125124
125+ ## Making Actions with Callables
126+
126127Aside from strings, any callable can be used as an action value. Here's an example where we use a
127128custom function as part of an action:
128129
129130``` {python}
130- def dq_issue ():
131+ def duration_issue ():
131132 from datetime import datetime
132133
133134 print(f"Data quality issue found ({datetime.now()}).")
134135
136+
135137validation_3 = (
136138 pb.Validate(
137139 data=pb.load_dataset(dataset="game_revenue", tbl_type="duckdb"),
@@ -142,7 +144,7 @@ validation_3 = (
142144 .col_vals_gt(
143145 columns="session_duration",
144146 value=15,
145- actions=pb.Actions(warning=dq_issue ),
147+ actions=pb.Actions(warning=duration_issue ),
146148 )
147149 .interrogate()
148150)
0 commit comments