sqlite3.OperationalError:没有这样的表:sqlite_schema

Vol*_*il3 12 python sqlite

我面临一个奇怪的问题。在 TablePlus 中,当我运行以下命令时,它会返回表,但相同的查询在 Python 中不起作用。

SELECT 
    name
FROM 
    sqlite_schema
WHERE 
    type ='table' 
    AND 
    name NOT LIKE 'lookup%';
Run Code Online (Sandbox Code Playgroud)

Python代码如下:

def get_connection():
    path = 'data.sqlite3'
    connection = sqlite3.connect(path)
    return connection

sql_select = "SELECT name FROM sqlite_schema WHERE type ='table' AND name NOT LIKE 'lookup%';"
cursor = connection.execute(sql_select)
Run Code Online (Sandbox Code Playgroud)

错误:

cursor = connection.execute(sql_select)
sqlite3.OperationalError: no such table: sqlite_schema
Run Code Online (Sandbox Code Playgroud)

我正在使用 SQLite 3.36

小智 7

在 PHP CPANEL VERSION 92 中将 sqlite_schema 更改为 sqlite_master,成功