12

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
6
  • 5
    sqlite.org/schematab.html - look at paragraph 2 for alternative names Commented Dec 20, 2021 at 7:50
  • 2
    @balderman so sqlite_master worked. But why sqlite_schema worked for the same db in TablePlus but not in Python? Commented Dec 20, 2021 at 7:54
  • I have no idea.. :-) Commented Dec 20, 2021 at 8:08
  • 1
    You may be using version 3.36 in TablePlus, but the Python version is older than that. What does select sqlite_version(); return in Python? Commented Dec 20, 2021 at 8:43
  • 5
    The name change took effect in version 3.33.0 Commented Dec 20, 2021 at 9:47

1 Answer 1

7

Change sqlite_schema for sqlite_master in PHP CPANEL VERSION 92, SUCCESS

answered Feb 10, 2022 at 2:12
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.