我正在尝试使用SELECT,FROM和WHERE通过模块pymssql进行查询。我在运行脚本时遇到“SyntaxError:EOL,同时扫描字符串文字”。我对SQL语法不太熟悉,但我在SQL上运行它。代码如下:
import pymssql
server = 'ip'
username = 'user'
password = 'pswrd'
cnxn = pymssql.connect(server, username, password, "tempdb")
cursor = cnxn.cursor()
query = "SELECT \"TIME_A\", \"TIME_B\", \"NAME\", \"NAME_B\", SOMETHING, SOMETHINGMORE, \"GROUP ALPHA\" \
FROM \"DATABASE\".\"db\".\"SUBDATABASE\" \
WHERE \"GROUP ALPHA\"=\'PEOPLE A\' \
OR \"GROUP ALPHA\"=\'PEOPLE B\' \
OR \"GROUP ALPHA\"=\'PEOPLE C\' \
OR \"GROUP ALPHA\"=\'PEOPLE D\' \
OR \"GROUP ALPHA\"=\'PEOPLE F\' \
OR \"GROUP ALPHA\"=\'PEOPLE E\' ";"
我需要帮助来确定我的语法错误在哪里运行得很好,感谢您抽出时间阅读我的询问。