From 9c5d11e9882d12b8b57d95fad268c876d584b267 Mon Sep 17 00:00:00 2001 From: Sebastian Daum Date: Sat, 27 Apr 2024 23:38:48 +0200 Subject: [PATCH] fix: sqa deprecations for airflow providers --- .../providers/fab/auth_manager/security_manager/override.py | 3 ++- airflow/providers/openlineage/utils/sql.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/airflow/providers/fab/auth_manager/security_manager/override.py b/airflow/providers/fab/auth_manager/security_manager/override.py index 56336b4fb295..5040ad0b9b79 100644 --- a/airflow/providers/fab/auth_manager/security_manager/override.py +++ b/airflow/providers/fab/auth_manager/security_manager/override.py @@ -1523,14 +1523,15 @@ def add_user( user.username = username user.email = email user.active = True + self.get_session.add(user) user.roles = role if isinstance(role, list) else [role] if hashed_password: user.password = hashed_password else: user.password = generate_password_hash(password) - self.get_session.add(user) self.get_session.commit() log.info(const.LOGMSG_INF_SEC_ADD_USER, username) + return user except Exception as e: log.error(const.LOGMSG_ERR_SEC_ADD_USER, e) diff --git a/airflow/providers/openlineage/utils/sql.py b/airflow/providers/openlineage/utils/sql.py index f5d083b4e469..e29d8c6511c8 100644 --- a/airflow/providers/openlineage/utils/sql.py +++ b/airflow/providers/openlineage/utils/sql.py @@ -155,7 +155,7 @@ def create_information_schema_query( sqlalchemy_engine: Engine | None = None, ) -> str: """Create query for getting table schemas from information schema.""" - metadata = MetaData(sqlalchemy_engine) + metadata = MetaData() select_statements = [] # Don't iterate over tables hierarchy, just pass it to query single information schema table if use_flat_cross_db_query: