How To Write Query As String On Python