GitHub user davikor created a discussion: How would you implement a HITL task 
that allows selection of records?

I am currently trying to design a workflow that is about to remove old data 
from a database. There is one catch: the data contains a free text field that 
is mostly empty but in some rare cases contains data. Since I cannot reliably 
analyze this field to determine whether the record should be removed, I want to 
use a HITL operator to present the list of records and the contents of that 
field to a user so that the user can select the records for removal manually. 

>From what I have seen, I could use a `HITLEntryOperator` with multiselect 
>enabled, but the presentation is not very good for this kind of selection, 
>because the texts can be longer and in general I would prefer a table view 
>with a row for each record for better overview. Also I need to present at 
>least the id of the record along with the free text, and of course I could 
>somehow concat these two into one string but I do not want to do this as long 
>as I absolutely have to.  

Alternatively I could simply use the `HITLOperator` and add a bool param for 
each record. This could work but I still miss the option to define a template 
and to provide more than just a string (e.g. the id, so I  know what to delete 
later on)

The 3rd option I can imagine is to spawn a task instance of 
`HITLApproveOperator` for each record and then I could display all the 
information required for decision making cleanly. but I would still prefer to 
have a kind of an overview table where the user can select all records in one 
step. 

My question is: is it possible to create a custom HITL operator with a custom 
template? I already inherited from the `HITLOperator` which obviously is 
possibly but I do not understand how to link a view or template to my custom 
operator and so I cannot really go on. Do you have a tutorial or is it 
documented somewhere (I already read the [custom operator 
docs](https://airflow.apache.org/docs/apache-airflow/stable/howto/custom-operator.html)?
 Or do you have another idea how to go for this requirement with the existing 
set of operators?

TIA David

GitHub link: https://github.com/apache/airflow/discussions/61668

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to