from tadas.domain.constants import MODEL_VERSION_RE, REPORTS TABLE_TYPES = ('output', 'combined', 'select_tracks', 'days_trending') def get_table_name(table_type: str, model_version: str, report: str) -> str: if table_type not in TABLE_TYPES: raise ValueError( f'Invalid table_type {table_type!r}; expected one of {TABLE_TYPES}' ) if not MODEL_VERSION_RE.fullmatch(model_version): raise ValueError( f'Invalid model_version {model_version!r}' ) if not report in REPORTS: raise ValueError( f'Invalid report {report!r}' ) table_name = f'tadas_{model_version}_{table_type}_{report}' return table_name TADAS_HISTORICAL_TABLE = 'tadas_historical'