sqlite3.OperationalError: no such table: sqlite_schema

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3.OperationalError: no such table: sqlite_schema

simonstephan
Hi everyone,

I recently used OWLReady2 to create an ontology, with no issues.
I switched to RDFLib for a project.
And now that I go back to OWLReady2 I have an error :

sqlite3.OperationalError: no such table: sqlite_schema


Full message error is :

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    from owlready2 import *
  File "/usr/local/lib/python3.8/dist-packages/owlready2/__init__.py", line 129, in <module>
    default_world = IRIS = World()
  File "/usr/local/lib/python3.8/dist-packages/owlready2/namespace.py", line 443, in __init__
    self.set_backend(backend, filename, dbname, **kargs)
  File "/usr/local/lib/python3.8/dist-packages/owlready2/namespace.py", line 453, in set_backend
    self.graph = Graph(filename, world = self, **kargs)
  File "/usr/local/lib/python3.8/dist-packages/owlready2/triplelite.py", line 173, in __init__
    self.analyze()
  File "/usr/local/lib/python3.8/dist-packages/owlready2/triplelite.py", line 403, in analyze
    self.execute("""ANALYZE sqlite_schema""")
sqlite3.OperationalError: no such table: sqlite_schema


It's a new project, the only code i've writte is :

from owlready2 import *

I use Python3 for compile
I've already upgrade SQLite :

sqlite3 --version
3.34.1 2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f

If you have any idea ...
Thanks :)
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3.OperationalError: no such table: sqlite_schema

Jiba
Administrator
Hi,

sqlite_schema is normally a special/reserved schema of SQLite, that should exist.

Which version of Python are you using ?
Which version of SQLite3 ? you can get it as follows in Python:

import sqlite3
print(sqlite3.sqlite_version)

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3.OperationalError: no such table: sqlite_schema

simonstephan
Thanks for your answer,

When I try to get my SQLite version on my CMD, I've this answer :

$ sqlite3 --version
==> 3.34.1

And when I try to get it with your Python Code, I've this one :
python3 main.py
==> 2.6.0

I think my Python isn't inform that I've updated my SQLite

I've already removed SQLite and install it again (only the 3.34 version)
How tell it to my python ?


Reply | Threaded
Open this post in threaded view
|

Re: sqlite3.OperationalError: no such table: sqlite_schema

Jiba
Administrator
Can you ask for the version of sqlite3 in Python ? It might be precompiled with Python itself.

You can do it as follows:

python
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.35.5'

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3.OperationalError: no such table: sqlite_schema

simonstephan
And now, when I make it directly in my terminal :

$ python3
Python 3.8.5 (default, May 27 2021, 13:30:53)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.31.1'
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3.OperationalError: no such table: sqlite_schema

simonstephan
My solution :

Version of SQLite in my Python3 was too low.

I just remove Python
apt-get remove python3

and install it again :
apt-get install python3

Now, i've SQLite version 3.34 and everything is Okay !

Thanks for your help.
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3.OperationalError: no such table: sqlite_schema

Jiba
Administrator
Ok, thank you for reporting the problem.

I investigated it from my side and "ANALYZE sqlite_schema" is actually only available with SQLite > 3.33.

I will publish a new release of Owlready with a workaround for older SQLite3.

Jiba