I am facing a weird issue. In TablePlus when I run the following command it returns table but same query does not work in Python.
SELECT
name
FROM
sqlite_schema
WHERE
type ='table'
AND
name NOT LIKE 'lookup%';
Python code is given below:
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)
Error:
cursor = connection.execute(sql_select)
sqlite3.OperationalError: no such table: sqlite_schema
I am using SQLite 3.36
asked Dec 20, 2021 at 7:47
Volatil3
15.1k40 gold badges151 silver badges298 bronze badges
1 Answer 1
Change sqlite_schema for sqlite_master in PHP CPANEL VERSION 92, SUCCESS
answered Feb 10, 2022 at 2:12
sergioriverafl
3031 gold badge4 silver badges6 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default
sqlite_masterworked. But whysqlite_schemaworked for the same db in TablePlus but not in Python?select sqlite_version();return in Python?