How can I write an SQL query as a template in PySpark