I am trying to clean up a Geopackage and as part of this I would like to delete some styles from the "layer_styles" table. I have tried doing this with the below query in the SQL window of the DB Manager in QGIS 3.4.3:

Delete from "layer_styles" where id = 48

When I run this I get the a database error popup window with the error message

SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 29468 and this is thread id 31144.

Does anyone know if my query is wrong or whether this is a limitation with the Geopackage format?

1 Answer 1


The limitation is not in SQLite but obviously in the way how QGIS is making the connection to SQLite database. See this Python issue https://bugs.python.org/issue27190

Starting in sqlite version 3.3.1 (Jan 2006) multiple threads can share the same connection.

However, by default the sharing is not allowed but software must initialize the connection with parameter "check_same_thread = False." See also for example https://github.com/ipython/ipython/issues/680.

I guess that QGIS could be safely made not to do the same-thread check because SQLite has had the support for 12 years now. Meanwhile you can try to remove the GeoPackage layers from the map and hope that the DB manager will then have the only thread talking with SQLite.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.