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 2021/06/08 23:53:03 UTC

[GitHub] [airflow] ekarsten opened a new pull request #16341: Pass parameters to PostgresHook from PostgresOperator

ekarsten opened a new pull request #16341:
URL: https://github.com/apache/airflow/pull/16341


   Passing extra kwargs from PostgresOperator to PostgresHook.
   
   This shouldn't need extra tests because it is a minor update to the PostgresOperator that doesn't change core functionality, so the existing tests of this operator should still be sufficient.
   
   There are no new dependencies introduced by this change and no backwards compatibility issues being introduced.
   
   closes: #16340
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
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] ekarsten commented on pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
ekarsten commented on pull request #16341:
URL: https://github.com/apache/airflow/pull/16341#issuecomment-857383697


   First, thanks for the tip on specifying this information in the connections tab of the UI. I will say that in my testing, I find that these changes lead to different results. Specifically, I have a long-running query that fails with `psycopg2.operationalerror: SSL SYSCALL error: EOF detected` when I run it using the `PostgresOperator` but when I make the changes outlined in this PR, the query runs without the error. I can't quite trace through how the extra parameters are getting passed through all the classes, but I think they are. Do you have a guess as to why this might be the case. I was trying to figure out if it was something in the [DbApiHook class](https://github.com/apache/airflow/blob/2aed14675e87ddc46b329b96c8d6b061ef66ec52/airflow/hooks/dbapi.py#L45), but I couldn't figure out what there is leading to this different behavior. 


-- 
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] uranusjr commented on pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #16341:
URL: https://github.com/apache/airflow/pull/16341#issuecomment-857374084


   That’s the extra field on the connection, but I don’t think passing the extras as an argument to `PostgresHook` would end up in there? Instead you need to set them [on the connection](https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html).


-- 
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] ekarsten commented on pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
ekarsten commented on pull request #16341:
URL: https://github.com/apache/airflow/pull/16341#issuecomment-857363291


   The `extra` kwarg is used in a few places in the `PostgresHook`. For example line 91 [here](https://github.com/apache/airflow/blob/main/airflow/providers/postgres/hooks/postgres.py#L91). The usage of extras is documented [here](https://airflow.apache.org/docs/apache-airflow-providers-postgres/stable/_api/airflow/providers/postgres/hooks/postgres/index.html). I believe it is inherited from the [connection class](https://github.com/apache/airflow/blob/main/airflow/models/connection.py).


-- 
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] boring-cyborg[bot] commented on pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #16341:
URL: https://github.com/apache/airflow/pull/16341#issuecomment-857267758


   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, pylint and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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] ekarsten commented on pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
ekarsten commented on pull request #16341:
URL: https://github.com/apache/airflow/pull/16341#issuecomment-857899644


   Closing this PR because it appears to not be a real issue (closed the issue as well).


-- 
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] ekarsten closed pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
ekarsten closed pull request #16341:
URL: https://github.com/apache/airflow/pull/16341


   


-- 
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] uranusjr commented on pull request #16341: Pass parameters to PostgresHook from PostgresOperator

Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #16341:
URL: https://github.com/apache/airflow/pull/16341#issuecomment-857359704


   I think I’m missing something. What does the `extra` kwarg do? It is not handled anywhere in `PostgresHook` from what I can tell.


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