This should be as simple as calling SqlRender::loadRenderTranslateSql with variables stored in namespace.
An addition could be to support comment headers that indicate if the file is for queries that return results or blocks of sql statements that should be executed