Skip to content

Commit

Permalink
[AIRFLOW-5727] SqoopHook: Build --connect parameter only if port/sche…
Browse files Browse the repository at this point in the history
…ma are defined (#6397)

(cherry picked from commit 4649563)
  • Loading branch information
Minutis authored and ashb committed Dec 16, 2019
1 parent 4569ee7 commit b5d7cfb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions airflow/contrib/hooks/sqoop_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,12 @@ def _prepare_command(self, export=False):
if self.hcatalog_table:
connection_cmd += ["--hcatalog-table", self.hcatalog_table]

connection_cmd += ["--connect", "{}:{}/{}".format(
self.conn.host,
self.conn.port,
self.conn.schema
)]
connect_str = self.conn.host
if self.conn.port:
connect_str += ":{}".format(self.conn.port)
if self.conn.schema:
connect_str += "/{}".format(self.conn.schema)
connection_cmd += ["--connect", connect_str]

return connection_cmd

Expand Down

0 comments on commit b5d7cfb

Please sign in to comment.