code: def get_sql(query):
      
      sql = str(query.statement.compile(dialect=sqlite.dialect(),
                                        compile_kwargs={"literal_binds": True}))
      return sql
docs: Returns the sql query