Skip to content

Commit

Permalink
Remove conn.close() ignores (#29005)
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Jan 18, 2023
1 parent 7689592 commit 85f8df7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/apache/hive/transfers/mysql_to_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def execute(self, context: Context):
csv_writer.writerows(cursor)
f.flush()
cursor.close()
conn.close() # type: ignore[misc]
conn.close()
self.log.info("Loading file into Hive")
hive.load_file(
f.name,
Expand Down
10 changes: 5 additions & 5 deletions airflow/providers/mysql/hooks/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def set_autocommit(self, conn: MySQLConnectionTypes, autocommit: bool) -> None:
if hasattr(conn.__class__, "autocommit") and isinstance(conn.__class__.autocommit, property):
conn.autocommit = autocommit
else:
conn.autocommit(autocommit) # type: ignore[operator]
conn.autocommit(autocommit)

def get_autocommit(self, conn: MySQLConnectionTypes) -> bool:
"""
Expand All @@ -93,7 +93,7 @@ def get_autocommit(self, conn: MySQLConnectionTypes) -> bool:
if hasattr(conn.__class__, "autocommit") and isinstance(conn.__class__.autocommit, property):
return conn.autocommit
else:
return conn.get_autocommit() # type: ignore[union-attr]
return conn.get_autocommit()

def _get_conn_config_mysql_client(self, conn: Connection) -> dict:
conn_config = {
Expand Down Expand Up @@ -199,7 +199,7 @@ def bulk_load(self, table: str, tmp_file: str) -> None:
"""
)
conn.commit()
conn.close() # type: ignore[misc]
conn.close()

def bulk_dump(self, table: str, tmp_file: str) -> None:
"""Dump a database table into a tab-delimited file."""
Expand All @@ -212,7 +212,7 @@ def bulk_dump(self, table: str, tmp_file: str) -> None:
"""
)
conn.commit()
conn.close() # type: ignore[misc]
conn.close()

@staticmethod
def _serialize_cell(cell: object, conn: Connection | None = None) -> Any:
Expand Down Expand Up @@ -283,4 +283,4 @@ def bulk_load_custom(

cursor.close()
conn.commit()
conn.close() # type: ignore[misc]
conn.close()

0 comments on commit 85f8df7

Please sign in to comment.