-
Hello! Could you help me to understand what is the purpose of extra connection field, please? I used to keep in "extra" any specific for my project properties. For example, "oracle" connection contains information to handle connection to this database from Spark. So, I am able to connect to Oracle database with Spark and directly form Airflow and to keep connection information for these cases in single place.
It works well, because Oracle provider uses get method to connect parameters from extra: Kafka provider sends the whole "extra" field content to Consumer constrictor and fails, because it faced unexpected arguments
https://github.com/apache/airflow/blob/main/airflow/providers/apache/kafka/hooks/base.py#L62
https://github.com/apache/airflow/blob/main/airflow/providers/apache/kafka/hooks/consume.py#L40 Is it good practice to have specific to project key-value in extra or should i avoid it? It there any rule for it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Axtra is Airflow way to get generic way of defining extra parameters but they are handled by each connection in the way how author of the connection decided it to use them. Look at the docs/code of every connection (defined by Hooks) to see whch extras are supported. If Kafka has connection does not support extras, it makes no sense to add it there. Extra is "airflow" specific field and if somoene decided in Kafka connection to put Your use of extras to handle "your" data is just wrong and it is not going to work in general case so don't do it. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Axtra is Airflow way to get generic way of defining extra parameters but they are handled by each connection in the way how author of the connection decided it to use them.
Look at the docs/code of every connection (defined by Hooks) to see whch extras are supported. If Kafka has connection does not support extras, it makes no sense to add it there. Extra is "airflow" specific field and if somoene decided in Kafka connection to put
extra
fields in config then this is how Kafka connection handles it - and you have to adapt to it. Look at the docs and if in doubt - at the code.Your use of extras to handle "your" data is just wrong and it is not going to work in general case so don't do it.