You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@airflow.apache.org by Achille B <Ac...@hotmail.fr> on 2020/03/03 11:00:54 UTC

Use a variable generated in a python function in a mail operator

Good morning everyone,

I would like to use the "listeticketid" variable, variable returned by python function: creationticket in the EmailOperator.

I tried like this but it didn't work, would you have an idea how to solve my problem please?


[cid:3c98b633-1ffe-41bf-b730-a9aac2c1fc6c]

Thanks in advance

Re: Use a variable generated in a python function in a mail operator

Posted by Kaxil Naik <ka...@gmail.com>.
Glad I was able to help.

On Tue, Mar 3, 2020 at 1:15 PM Achille B <ac...@hotmail.fr> wrote:

> It works now.
>
> Thank you for your help and this quick return 🙂
>
> ------------------------------
> *De :* Kaxil Naik <ka...@gmail.com>
> *Envoyé :* mardi 3 mars 2020 12:46
> *À :* users@airflow.apache.org <us...@airflow.apache.org>
> *Objet :* Re: Use a variable generated in a python function in a mail
> operator
>
> You will need to use *Xcom
> <https://airflow.apache.org/docs/stable/concepts.html?highlight=xcom#xcoms>.*
>
> Pass *provide_context=True *in PythonOperator ( creation_ticket task) and
> use the following in *html_content* in EmailOperator( *email* task):
>
> html_content = "<h3> Numberos des oceanes generess</h3> {{
> ti.xcom_pull(task_ids='creationticket') }}"
>
> Regards,
> Kaxil
>
> On Tue, Mar 3, 2020 at 11:01 AM Achille B <Ac...@hotmail.fr> wrote:
>
> Good morning everyone,
>
> I would like to use the "listeticketid" variable, variable returned by
> python function: creationticket in the EmailOperator.
>
> I tried like this but it didn't work, would you have an idea how to solve
> my problem please?
>
>
>
> Thanks in advance
>
>

RE: Use a variable generated in a python function in a mail operator

Posted by Achille B <ac...@hotmail.fr>.
It works now.

Thank you for your help and this quick return 🙂

________________________________
De : Kaxil Naik <ka...@gmail.com>
Envoyé : mardi 3 mars 2020 12:46
À : users@airflow.apache.org <us...@airflow.apache.org>
Objet : Re: Use a variable generated in a python function in a mail operator

You will need to use Xcom<https://airflow.apache.org/docs/stable/concepts.html?highlight=xcom#xcoms>.

Pass provide_context=True in PythonOperator ( creation_ticket task) and use the following in html_content in EmailOperator( email task):

html_content = "<h3> Numberos des oceanes generess</h3> {{ ti.xcom_pull(task_ids='creationticket') }}"

Regards,
Kaxil

On Tue, Mar 3, 2020 at 11:01 AM Achille B <Ac...@hotmail.fr>> wrote:
Good morning everyone,

I would like to use the "listeticketid" variable, variable returned by python function: creationticket in the EmailOperator.

I tried like this but it didn't work, would you have an idea how to solve my problem please?


[cid:170a035024dcb971f161]

Thanks in advance

Re: Use a variable generated in a python function in a mail operator

Posted by Kaxil Naik <ka...@gmail.com>.
You will need to use *Xcom
<https://airflow.apache.org/docs/stable/concepts.html?highlight=xcom#xcoms>.*

Pass *provide_context=True *in PythonOperator ( creation_ticket task) and
use the following in *html_content* in EmailOperator( *email* task):

html_content = "<h3> Numberos des oceanes generess</h3> {{
ti.xcom_pull(task_ids='creationticket') }}"

Regards,
Kaxil

On Tue, Mar 3, 2020 at 11:01 AM Achille B <Ac...@hotmail.fr> wrote:

> Good morning everyone,
>
> I would like to use the "listeticketid" variable, variable returned by
> python function: creationticket in the EmailOperator.
>
> I tried like this but it didn't work, would you have an idea how to solve
> my problem please?
>
>
>
> Thanks in advance
>