pierrejeambrun commented on code in PR #50758:
URL: https://github.com/apache/airflow/pull/50758#discussion_r2097404886
##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -523,3 +523,12 @@ def drop_archived_tables(
session.execute(text(f"DROP TABLE {table_name}"))
dropped_count += 1
logger.info("Total dropped tables: %s", dropped_count)
+
+
+def calculate_table_size(
+ *,
+ table_name: str,
+ session: Session,
+) -> float | None:
+ """Calculate table size in megabytes."""
+ return 0
Review Comment:
Looks like the implementation is not done yet.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/db.py:
##########
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from fastapi import Depends
+from sqlalchemy import func
+
+from airflow.api_fastapi.common.db.common import SessionDep
+from airflow.api_fastapi.common.parameters import QuerySkipRecordCount,
QuerySkipTableSize, QueryTablesFilter
+from airflow.api_fastapi.common.router import AirflowRouter
+from airflow.api_fastapi.core_api.datamodels.db import
MetadataDBStatsResponse, TableStats
+from airflow.api_fastapi.core_api.security import requires_access_db
+from airflow.utils.db import reflect_tables
+from airflow.utils.db_cleanup import _effective_table_names,
calculate_table_size
+
+db_router = AirflowRouter(tags=["Maintenance"], prefix="/maintenance/db")
Review Comment:
Not sure about the `maintenance` prefix/tag. Maybe `db` is good enough ?
--
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]