Skip to content

AwsBaseHook isn't using connection.host, using connection.extra.host instead #17833

Closed

Description

@alwaysmpe

Apache Airflow version:

Version: v2.1.2
Git Version: .release:2.1.2+d25854dd413aa68ea70fb1ade7fe01425f456192

OS:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Apache Airflow Provider versions:

Deployment:

Docker compose using reference docker compose from here: https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html

What happened:

Connection specifications have a host field. This is declared as a member variable of the connection class here:

host = Column(String(500))

It's correctly used in the BaseHook class, eg here:
if conn.host:

However in AwsBaseHook, it's expected to be in extra, here:
connection_object = self.get_connection(self.aws_conn_id)
extra_config = connection_object.extra_dejson
endpoint_url = extra_config.get("host")

This should be changed to
endpoint_url = connection_object.host

What you expected to happen:

AwsBaseHook should use the connection.host value, not connection.extra.host

How to reproduce it:

See above code

Anything else we need to know:

Are you willing to submit a PR?

Probably. It'd also be good for someone inexperienced. This would represent a backwards-incompatible change, any problem with that?

Activity

  1. boring-cyborg commented on Aug 25, 2021

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

  2. potiuk commented on Aug 25, 2021

    @potiuk
    Member

    Nice one. @alwaysmpe - I can assign you this one.

    You can make it in the way that it checks if "host" is in extra an uses it from there if it's there (+raise a deprecation warning) and falls-back to connection.host otherwise. This will make it backwards compatible (and we will be able to remove it in the future then).

  3. blcksrx commented on Aug 27, 2021

    @blcksrx
    Contributor

    In my opinion its better to put a deprecation warning as the first step to not broke user connection.

  4. alwaysmpe commented on Sep 2, 2021

    @alwaysmpe
    Author

    FYI: I'm currently moving house. Should have a look at this over the weekend. My thought was leave the current functionality working as is with a deprecated warning. Then if the host value in extra isn't present, use the connection defined version. Probably needs to combine host/port number, so I'll add a function to the connection to do that.

  5. ashb commented on Sep 2, 2021

    @ashb
    Member

    FYI: I'm currently moving house. Should have a look at this over the weekend. My thought was leave the current functionality working as is with a deprecated warning. Then if the host value in extra isn't present, use the connection defined version. Probably needs to combine host/port number, so I'll add a function to the connection to do that.

    That sounds about right, yes

  6. prajvan commented on Oct 9, 2021

    @prajvan

    hi @ashb i can take this up, if it isnt being worked upon

  7. potiuk commented on Oct 9, 2021

    @potiuk
    Member

    Depends if @alwaysmpe wants to continue, but generally feel free.

  8. alwaysmpe commented on Oct 9, 2021

    @alwaysmpe
    Author

    @prajvan feel free! Life's been complicated, this slipped the to-do list a bit.

  9. eshabhide commented on Feb 28, 2022

    @eshabhide

    Hi, looks like this issue is not getting any traction. I am happy to take a look at it.

  10. eladkal commented on Feb 28, 2022

    @eladkal
    Contributor

    @eshabhide assigned to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions