As seen in [[ https://github.com/wikimedia/wmfdata-python/blob/2ae3b559898f40d84493d475c0e2a83969b65985/wmfdata/mariadb.py#L50-L62 | wmfdata.mariadb ]] the connection code relies on `analytics-mysql` utility ([[ https://gerrit.wikimedia.org/r/plugins/gitiles/analytics/refinery/+/refs/heads/master/bin/analytics-mysql | source ]]), which prints out the host & port info which are then parsed.
It depends on that utility to be available at the system level. One idea is to factor that functionality out of refinery into a separate small package that can be used by both refinery and wmfdata-python, but it's not trivial to change the deployment strategy for refinery in that case.
Either way, wmfdata-py needs to get that information somehow when it's running on the cluster and used in an Airflow data pipeline.