When executing a stored procedure or job with the MsSqlOperator, the task always ends OK, even if the stored procedure/job ends with an error.
How can I capture the RC of the execution so that the task status reflects the status of the stored procedure/job?
from airflow.providers.microsoft.mssql.operators.mssql import MsSqlOperator
(...)
sql_query_exec_sp= "EXEC dbo.sp_start_job N'ARSHD_USERS'"
(...)
run_sp1 = MsSqlOperator(
task_id='Run_SP1',
mssql_conn_id='mssql_test_conn_msdb',
sql=sql_query_exec_sp,
autocommit=True
(...)
I'm thinking of creating another Task to check if the result of the stored procedure execution were correct but in the future when I had tens of different stored procedure executions it will be unmanageable!
Thanks for all the help you can give me.