AttributeError: 'pysqlite2.dbapi2.Connection' object has no attribute 'execute'

Tim Chick chick at computergeek.freeserve.co.uk
Wed Jan 16 22:16:43 UTC 2008


On Tuesday 15 January 2008 01:57:36 Steve Sakoman wrote:
> Several folks who are attempting to use OE for gumstix are
> encountering the issue below:
>
I wonder if it's the same problem I saw - see the following mail, but 
basically bitbake was changed to use an sqlite3 feature, without any real 
reason...

If you already have sqlite3 then that's not it, but if you have sqlite2 and 
bitbake 1.8.8 or later, this may be it.


Hi All,

I posted this on the Angstrom mailing, but thought I would post here. 
It's a simple change to allow 1.8.8 or later work with sqlite2:

The 1.8.8 bitbake uses sqlite to keep some persistent store, but it does 
not work with sqlite2 - it uses DROP TABLE IF EXISTS and CREATE TABLE 
IF NOT EXISTS, which were only added with sqlite3

This fixes it for me, and will work with sqlite3, but I'm not much of an 
sql or python man!

Index: lib/bb/persist_data.py
===================================================================
--- lib/bb/persist_data.py      (revision 973)
+++ lib/bb/persist_data.py      (working copy)
@@ -57,13 +57,19 @@
         Should be called before any domain is used
         Creates it if it doesn't exist.
         """
-        self.connection.execute("CREATE TABLE IF NOT EXISTS %s(key 
TEXT, value TEXT);" % domain)
+        try:
+            self.connection.execute("CREATE TABLE %s(key TEXT, value 
TEXT);" % domain)
+        except:
+           bb.msg.debug(1, bb.msg.domain.PersistData, "Create 
table '%s' failed" % domain)

     def delDomain(self, domain):
         """
         Removes a domain and all the data it contains
         """
-        self.connection.execute("DROP TABLE IF EXISTS %s;" % domain)
+       try:
+            self.connection.execute("DROP TABLE %s;" % domain)
+        except:
+           bb.msg.debug(1, bb.msg.domain.PersistData, "Delete 
table '%s' failed" % domain)

     def getValue(self, domain, key):
         """

Thanks,
Tim





More information about the Openembedded-users mailing list