I was running into this same issue. I am using doc-strings and it turns out that passing it as raw stings does the job.
example: r """Select * from ..."""