无法 select sqlite3 数据库上的列

Unable to select a column on sqlite3 database

我正在尝试 select sqlite 数据库中 table 的特定列。我正在使用以下内容:

cursor = connection.execute('select Case from SUMMARY')

即使列名正确,每当我 运行 代码时,我都会收到以下错误。

当我尝试获取列索引时,也会发生同样的情况。

每当我尝试任何其他列时,我都可以获取该列的所有数据。

OperationalError                          Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15288/2883478922.py in <module>
      1 import sqlite3
      2 connection = sqlite3.connect("../DB_Cases.sqlite")
----> 3 cursor = connection.execute('select Case from SUMMARY') 

OperationalError: near "from": syntax error

case 在 SQLite 中是 reserved keyword

如 SQLite 文档中所述,在查询中使用双引号应该可以使您的查询正常工作。