Content-Length: 390871 | pFad | http://github.com/apache/airflow/pull/50758

5A Add endpoint for DB stats by rawwar · Pull Request #50758 · apache/airflow · GitHub
Skip to content

Add endpoint for DB stats #50758

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

rawwar
Copy link
Contributor

@rawwar rawwar commented May 19, 2025

I am adding an endpoint to retrieve DB stats. For now, I am including only the table's name, the oldest record present in the table, and the number of records in the table. This can be extended in the future.

TODO:

  • additional permission for DB endpoints - GET, POST - Only available for admins by default
  • Add additional field to TableStats for size of the table in MB - Very useful to determine if a clean up is necessary will be doing this as part of a separate PR

@boring-cyborg boring-cyborg bot added area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels May 19, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks

Can we add tests for endpoint.

Can you provide more context to why this public endpoint is needed ?

Sorry for the early review, I just noticed it went to draft.

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the maintenance prefix/tag. Maybe db is good enough ?

Comment on lines +528 to +534
def calculate_table_size(
*,
table_name: str,
session: Session,
) -> float | None:
"""Calculate table size in megabytes."""
return 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the implementation is not done yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Wanted to keep few issues as good first issues for MLH internship folks to pick them up

@pierrejeambrun pierrejeambrun added this to the Airflow 3.1.0 milestone May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/apache/airflow/pull/50758

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy