【发布时间】:2022-01-06 03:35:22
【问题描述】:
我正在尝试在我的 python 笔记本中运行 sql 查询,
单元格中的代码看起来像
sql = "select date, count(distinct id)
from table
group by 1;"
当我运行时,我得到一个错误
SyntaxError: unterminated string literal (detected at line 1)
我想我发现了错误,当我删除行之间的空格时,它会消失并运行,例如:
"select date, count(distinct id) from table group by 1;"
问题是我的示例查询,但是我有大型查询,很难将它们退格到一行中,有没有一种方法可以让我在没有一行的情况下运行它?谢谢
【问题讨论】:
标签: python sql python-3.x