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

Revert "Remove conn.close() ignores (#29005)" #29010

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
conn.close() # type: ignore[misc]
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)
conn.autocommit(autocommit) # type: ignore[operator]

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()
return conn.get_autocommit() # type: ignore[union-attr]

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()
conn.close() # type: ignore[misc]

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()
conn.close() # type: ignore[misc]

@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()
conn.close() # type: ignore[misc]