"""Connection helper for the read-only employee directory database. Credentials are pulled from app config (env-backed, see Config.EMPLOYEE_DB_*), never hardcoded. Used by the employee lookup API and the notification recognition feature. """ import pymysql from flask import current_app def employee_connection(): """Open a pymysql connection to the employee directory DB.""" return pymysql.connect( host=current_app.config['EMPLOYEE_DB_HOST'], user=current_app.config['EMPLOYEE_DB_USER'], password=current_app.config['EMPLOYEE_DB_PASSWORD'], database=current_app.config['EMPLOYEE_DB_NAME'], cursorclass=pymysql.cursors.DictCursor, )