Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid passing aws_conn_id as conn_args for psycopg2.connect #16100

Merged
merged 4 commits into from Jun 12, 2021

Conversation

gabrielsyapse
Copy link
Contributor

  • In the postgres hook code, the conn_args was changed from a whitelist to blacklist at some point
  • aws_conn_id should be removed from conn_args and not passed to psycopg2.connect
  • the psycopg2 fails to create the connection because aws_conn_id is an unknown param to postgres

@boring-cyborg
Copy link

boring-cyborg bot commented May 26, 2021

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/master/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits 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 Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment 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 for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    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

@eladkal eladkal requested a review from xinbinhuang May 28, 2021 12:08
@xinbinhuang
Copy link
Contributor

@gabrielsyapse Hi thanks for the contribution! The change looks fine to me, but it seems that this's more a problem on the usage than the actual code itself. - *_conn_id should never go into the extra field in any situation. I wonder what's the use case and problem you have?

@gabrielsyapse
Copy link
Contributor Author

@ xinbinhuang thanks for the reply, line 48-52 of this file documents the usage. also it was working previously in airflow 1.x

extras example: ``{"iam":true, "aws_conn_id":"my_aws_conn"}``

@xinbinhuang
Copy link
Contributor

@gabrielsyapse ah you're right! Would you mind also adding a test case here? This can help us avoid this from happening again in the future.

@xinbinhuang xinbinhuang added the kind:bug This is a clearly a bug label Jun 1, 2021
@xinbinhuang xinbinhuang changed the title postgres_hook_aws_conn_id Avoid passing aws_conn_id as conn_args for p Jun 1, 2021
@xinbinhuang xinbinhuang changed the title Avoid passing aws_conn_id as conn_args for p Avoid passing aws_conn_id as conn_args for psycopg2.connect Jun 1, 2021
@xinbinhuang xinbinhuang self-requested a review June 8, 2021 04:12
@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jun 8, 2021
@github-actions
Copy link

github-actions bot commented Jun 8, 2021

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@jhtimmins
Copy link
Contributor

@gabrielsyapse can you try rebasing and then running the pre-commit checks on this? That should address the failing static check https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst

@potiuk potiuk merged commit d99afc3 into apache:main Jun 12, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 12, 2021

Awesome work, congrats on your first merged pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers kind:bug This is a clearly a bug okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants