Error when searching the ontology : "sqlite3.OperationalError: too many SQL variables"

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

Error when searching the ontology : "sqlite3.OperationalError: too many SQL variables"

Hussein
When I search against my Ontology with a command like this:

`cls_parent = onto.search_one(label='ethiopia')`
`cls = onto.search_one(label='afar', is_a=cls_parent)`

I get the error - "sqlite3.OperationalError: too many SQL variables"

Yet if I search as follows:

`cls = onto.search_one(label='afar')`

The search works. This error isn't consistent though - the Class `afar` happens to have a Parent Class with many Subclasses and a lot of nesting within the Subclasses, but in some cases the search works well when the Parent Class doesn't have many Subclasses with nesting, so I wonder if the size and complexity of my Ontology is the issue but in that case, what can I use to perform the search (it's important for me to search in this specific way)?

Thank you, all!
Reply | Threaded
Open this post in threaded view
|

Re: Error when searching the ontology : "sqlite3.OperationalError: too many SQL variables"

Jiba
Administrator
Hi,

I think this problem occurs when cls_parent has more than 999 descendants classes. In the current implementation of search, each descendant classes requires an SQL variable, and they are limited in SQLite.

I've written a different implementation in the development version of Owlready on BitBucket, using recursive SQL queries. It is no longer limited by the number of descendant classes, and is also be faster. Could you verify if it work well now, please?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Error when searching the ontology : "sqlite3.OperationalError: too many SQL variables"

Hussein
Hi Jiba,

I tried the version from BitBucket and the error is gone! And truly, the search is much faster too! Thanks very much for the quick response and this fantastic library!

Kind Regards,

Hussein
Reply | Threaded
Open this post in threaded view
|

Re: Error when searching the ontology : "sqlite3.OperationalError: too many SQL variables"

Hussein
Hi Jiba,

I see you've got version 0.15 planned which will contain this fix - among other improvements - would it be possible to know when a production version on PyPi may be made available?

Thanks and regards,

Hussein
Reply | Threaded
Open this post in threaded view
|

Re: Error when searching the ontology : "sqlite3.OperationalError: too many SQL variables"

Jiba
Administrator
Hi,

I am quite busy this week with university exams, but I will try to release 0.15 next week.

Jiba