Skip to content

Conversation

@VBhojawala
Copy link
Contributor

added template_fields to support upstream task ordering by xcom .

from airflow.models import DAG
from airflow.providers.postgres.operators.postgres import PostgresOperator
import os

from airflow.utils.dates import days_ago

default_args = {'start_date': days_ago(1)}

dag_name = os.path.splitext(os.path.basename(__file__))[0]

with DAG(dag_name, default_args=default_args) as dag:

    @dag.task
    def some_py_task() -> str:
        return some_str

    some_str = some_py_task()

    some_pg_task = PostgresOperator(task_id='some_pg_task', 
                     sql='select * from %s',
                     parameters=[some_str],
                     postgres_conn_id='postgres_bob')

pgtask

closes : #13823

@VBhojawala VBhojawala changed the title added template_fields to support upstream task ordering by xcom added ( 'op_args', 'op_kwargs') to template_fields to support upstream task ordering by xcom Jan 25, 2021
Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters aren't used anywhere, so this fix isn't correct.

@VBhojawala VBhojawala changed the title added ( 'op_args', 'op_kwargs') to template_fields to support upstream task ordering by xcom added parameters to template_fields to support upstream task ordering by xcom Feb 4, 2021
@VBhojawala VBhojawala requested a review from ashb February 4, 2021 16:50
@VBhojawala VBhojawala closed this Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Postgres Operator task doesn't sequence properly with TaskFlow API

2 participants