kalluripradeep commented on code in PR #59938:
URL: https://github.com/apache/airflow/pull/59938#discussion_r2655204924
##########
airflow-core/src/airflow/models/pool.py:
##########
@@ -36,6 +37,23 @@
from sqlalchemy.sql import Select
+def validate_pool_name(name: str) -> None:
+ """
+ Validate that pool name only contains valid characters for stats reporting.
+
+ Pool names must only contain ASCII alphabets, numbers, underscores, dots,
and dashes
+ to ensure compatibility with stats naming requirements.
+
+ :param name: The pool name to validate
+ :raises ValueError: If the pool name contains invalid characters
+ """
+ if not re.match(r"^[a-zA-Z0-9_.-]+$", name):
Review Comment:
@Prajwal7842 Good question! I looked into the stats validation code, but
it's in the statsd library (at the reporting level) rather than in Airflow
core.
Creating a separate validation function here has these benefits:
1. Catches invalid names early (at creation time) rather than at runtime
2. Provides clear, actionable error messages to users
3. Keeps the validation logic in one place in Airflow
However, if there's an existing Airflow utility function for stats name
validation that I missed, I'd be happy to use that instead. Could you point me
to it?
--
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]