[
https://issues.apache.org/jira/browse/AIRFLOW-6248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16995526#comment-16995526
]
Ash Berlin-Taylor edited comment on AIRFLOW-6248 at 12/13/19 10:14 AM:
-----------------------------------------------------------------------
Ideally no, it shouldn't, but the the "schema" (not to be confused with
"scheme") field is the connection type, so we want a "spark" connection, but to
run against "yarn://". It's all a bit messy.
HTTP type with https schema has similar confusing problems.
If you fancy trying to unpick it all that would be amazing :)
was (Author: ashb):
Ideally no, it shouldn't, but the the "schema" (not to be confused with
"scheme") defines the connection type. It's all a bit messy.
If you fancy trying to unpick it all that would be amazing :)
> Should host variable in Connection class contain scheme?
> --------------------------------------------------------
>
> Key: AIRFLOW-6248
> URL: https://issues.apache.org/jira/browse/AIRFLOW-6248
> Project: Apache Airflow
> Issue Type: Bug
> Components: models
> Affects Versions: 1.10.6
> Reporter: xifeng
> Priority: Trivial
> Fix For: 2.0.0
>
>
> In unit test, there are many snippets like:
> {code:python}
> db.merge_conn(
> Connection(
> conn_id='spark-default', conn_type='spark',
> host='yarn://yarn-master',
> extra='{"queue": "root.etl", "deploy-mode": "cluster"}')
> )
> {code}
> host var contains scheme("yarn://")
> However, if there is a *uri* instance var in Connection, the host of
> Connection would not contain scheme. this is because *parse_from_uri
> *function.
> {code:python}
> def parse_from_uri(self, uri):
> uri_parts = urlparse(uri)
> conn_type = uri_parts.scheme
> if conn_type == 'postgresql':
> conn_type = 'postgres'
> elif '-' in conn_type:
> conn_type = conn_type.replace('-', '_')
> self.conn_type = conn_type
> self.host = parse_netloc_to_hostname(uri_parts)
> quoted_schema = uri_parts.path[1:]
> self.schema = unquote(quoted_schema) if quoted_schema else
> quoted_schema
> self.login = unquote(uri_parts.username) \
> if uri_parts.username else uri_parts.username
> self.password = unquote(uri_parts.password) \
> if uri_parts.password else uri_parts.password
> self.port = uri_parts.port
> if uri_parts.query:
> self.extra = json.dumps(dict(parse_qsl(uri_parts.query,
> keep_blank_values=True)))
> {code}
> So, should the host contain scheme?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)