You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/07/22 23:31:00 UTC

[GitHub] [airflow] mik-laj opened a new issue #9942: Incorrect signature of operators

mik-laj opened a new issue #9942:
URL: https://github.com/apache/airflow/issues/9942


   Hello,
   
   Currently, the signatures of most operators look similar to the following.
   ```python
       @apply_defaults
       def __init__(
           self, sql: str, conn_id: Optional[str] = None, *args, **kwargs
       ) -> None:
           super().__init__(*args, **kwargs)
           self.conn_id = conn_id
           self.sql = sql
   ```
   There are two problems here.
   1. The ``apply_default`` decorator forces all arguments to be passed as keyword arguments, but this information is not marked in the signature. As of Python 3 it is possible to mark arguments as [keyword-only argument](https://www.python.org/dev/peps/pep-3102/).
   2. The `*args` is passed to the BaseOperator class, but this class does not accept positional arguments.
   
   The new operator signature may look like folllow
   ```python
       @apply_defaults
       def __init__(
           self, *, sql: str, conn_id: Optional[str] = None, **kwargs
       ) -> None:
           super().__init__(**kwargs)
           self.conn_id = conn_id
           self.sql = sql
   ```
   
   This change will allow the detection of improper operator initialization by static code analysis tools.
   
   Best regards,
   Kamil
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #9942: Incorrect signature of operators

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #9942:
URL: https://github.com/apache/airflow/issues/9942#issuecomment-668414920


   @LeonY1  I assigned you to this ticket. 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk closed issue #9942: Incorrect signature of operators

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #9942:
URL: https://github.com/apache/airflow/issues/9942


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #9942: Incorrect signature of operators

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #9942:
URL: https://github.com/apache/airflow/issues/9942#issuecomment-668412875


   @LeonY1  CLA is not required.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #9942: Incorrect signature of operators

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #9942:
URL: https://github.com/apache/airflow/issues/9942#issuecomment-669970608


   @LeonY1  You can start. You are already assigned to this ticket so I cannot assign you again.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LeonY1 commented on issue #9942: Incorrect signature of operators

Posted by GitBox <gi...@apache.org>.
LeonY1 commented on issue #9942:
URL: https://github.com/apache/airflow/issues/9942#issuecomment-669955892


   Should I also work on adding the positional marker back in?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LeonY1 commented on issue #9942: Incorrect signature of operators

Posted by GitBox <gi...@apache.org>.
LeonY1 commented on issue #9942:
URL: https://github.com/apache/airflow/issues/9942#issuecomment-668366342


   Is it okay if I take up this issue? Is there any CLA that I have to sign in order to contribute?
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org