schweizersta commented on issue #42344:
URL: https://github.com/apache/airflow/issues/42344#issuecomment-2363232661
I am not talking about DAG run parameters, but task parameters (given when
instantiating SQLExecuteQueryOperator).
With some more investigations I figured out how it works and what I am
trying to say:
In the previous section "Passing Parameters into SQLExecuteQueryOperator for
Postgres" of the second docu link you referred to, there are 2 examples:
1.
```
...
sql="SELECT * FROM pet WHERE birth_date BETWEEN SYMMETRIC %(begin_date)s
AND %(end_date)s",
parameters={"begin_date": "2020-01-01", "end_date": "2020-12-31"},
...
```
2.
```
...
sql="sql/birth_date.sql",
params={"begin_date": "2020-01-01", "end_date": "2020-12-31"},
...
```
In the second example (where the sql command is stored in a file), one has
to provide values for the sql parameters using `params=`. But it does not
matter how you access the paramters in the sql command, whether by using
`%(begin_date)` or `{{ params.begin_date }}`, both of them work fine.
What got me confused, is the statement at the beginning of this section,
where it says: "Both parameters and params make it possible to dynamically pass
in parameters in many interesting ways.". So I thougt, I can use either params
or parameters in both cases. But that "parameter" is only valid for the first
case and "params" only for the second one, was not obvious to me.
Now that I know how it's meant to be, I leave it up to you, if you want to
clarify this more in the docu or not.
--
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]