SameerMesiah97 commented on code in PR #69768:
URL: https://github.com/apache/airflow/pull/69768#discussion_r3642144238


##########
airflow-core/src/airflow/cli/commands/team_command.py:
##########
@@ -118,9 +135,19 @@ def team_delete(args, *, session=NEW_SESSION):
         associations.append(f"{variable_count} variable(s)")
 
     # Check pool associations
-    if pool_count := 
session.scalar(select(func.count(Pool.id)).where(Pool.team_name == team.name)):
+    if pool_count := session.scalar(
+        select(func.count(Pool.id)).where(
+            Pool.team_name == team.name,
+            Pool.pool != Pool.get_default_team_pool_name(team.name),
+        )
+    ):
         associations.append(f"{pool_count} pool(s)")
 
+    default_pool = session.scalar(select(Pool).where(Pool.pool == 
Pool.get_default_team_pool_name(team.name)))
+
+    if default_pool:
+        session.delete(default_pool)

Review Comment:
   This has been moved down to the try/except block where team deletion is 
attempted.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to