bdsoha commented on PR #27319:
URL: https://github.com/apache/airflow/pull/27319#issuecomment-1302688100
> @uranusjr
>
> > the various split calls make it pretty difficult to follow what exactly
is being extracted from the exception. (Why not just push str(e) and move
extraction logic into downstream tasks, for example?)
>
> okaaay... I was actually thinking of these alternatives and previuosly
decided to split fully in the operator)
>
> But, okay I could accept that here I relied on too many tiny steps in
which smth could be changed in future.
>
> Assume Oracle throws the following: `ORA-28365: wallet is not open`
>
> Is that acceptable to just split the original output into two parts by `:`
and push `ORA-28365` to XCOM ❓ Doing so, `code.split('-')[1]` will disappear.
>
> The reasons I'd like to cut the message is that
>
> 1. It could be long length
> 2. It's useless in XCOM and, if interested, it's still presented in logs.
> I mean `ORA-code` needs for logic, text output only needs for debuging.
You can accomplish the same thing using *regex*:
```pythom
import re
code = re.search("^ORA-(\\d+):.+", "ORA-28365: wallet is not open").group(1)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]