If you are going to define @dmltable different from @fromtables, it would be better to consistently let @fromtables be based on the schema (using _table) and to hard-code @dmltable. The schema.py column names should match the schema.py table names.