sqlite no attribute'autocommit' ticket 763

36 views
Skip to first unread message

Jorge Vargas

unread,
Apr 18, 2006, 5:16:50 PM4/18/06
to turbo...@googlegroups.com
I have seem many people come across this over time (including myself)

So I'm determine to fix it
http://trac.turbogears.org/turbogears/ticket/763#preview


Could you please help me collect information on where the bug is present.

So far I know the following

- it's or sqlite only (therefore the bug should be in pysqlite or the SQLObject wrapping class)
- This is a windows only bug (although I remenber one comment saying he/she thinks that has seen it on linux, if your this person please confirm)
- it's a 0.9x issue (no reports of it before 0.9x)
- its MODEL dependant (i just found this out) I try to diferent models and one worked the other didnt.


I use

from sqlobject import *
from turbogears.database import PackageHub
# Uncomment the following line if you wish to use Identity and SO_Provider
# from turbogears.identity.soprovider import TG_User, TG_Group, TG_Permission

hub = PackageHub("wiki20")
__connection__ = hub

class Page(SQLObject):
    pagename=StringCol(alternateID=True, length=30)
    data=StringCol()

class B(SQLObject):
    number=IntCol()
    a=RelatedJoin('Page')
   
class A(SQLObject):
    b=ForeignKey('B')

I started adding things one by one and the error came up went I add the RelatedJoin

Jorge Vargas

unread,
Apr 18, 2006, 5:32:56 PM4/18/06
to turbo...@googlegroups.com
sorry for the double post just an update

went doing tg-admin sql drop I found this

pysqlite2.dbapi2.OperationalError: no such table: b_page


after that no mather what I do all commands render the same error, even if I delete the database file.

also interesting to note is that even if the file is not present

tg-admin sql list will show the 3 tables in the model file..

Mark Ramm

unread,
Apr 18, 2006, 8:48:45 PM4/18/06
to turbo...@googlegroups.com
> So far I know the following
>
> - it's or sqlite only (therefore the bug should be in pysqlite or the
> SQLObject wrapping class)
> - This is a windows only bug (although I remenber one comment saying he/she
> thinks that has seen it on linux, if your this person please confirm)
> - it's a 0.9x issue (no reports of it before 0.9x)
> - its MODEL dependant (i just found this out) I try to diferent models and
> one worked the other didnt.

I saw this on the Trunk in January, so it pre-dates the release of
0.9, but comes much later than 0.8. I also had a similar problem on
Linux, which was resolved by updating SQLite to version 3.


--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog

Mark Ramm

unread,
Apr 18, 2006, 8:51:00 PM4/18/06
to turbo...@googlegroups.com
> I saw this on the Trunk in January, so it pre-dates the release of
> 0.9, but comes much later than 0.8. I also had a similar problem on
> Linux, which was resolved by updating SQLite to version 3.

That makes it sound like the bugs were the same, and I don't think
they were. But I thought I'd point out that there is the (slim but
real) possibility of that there could be a platform specific problem
in SQLite...

Jorge Vargas

unread,
Apr 18, 2006, 10:40:50 PM4/18/06
to turbo...@googlegroups.com

Well i'm running sqlite 3.3.4 at home and its not happening. I know it's a 3.x at work (which is where I get the error) i'll check the exact version tomorrow.

Damjan

unread,
Apr 19, 2006, 9:05:16 AM4/19/06
to TurboGears
If we are talkin about this error:
godot2$ tg-admin sql create
Using database URI sqlite:///tmp/godot2.db
Exception exceptions.AttributeError: "'pysqlite2.dbapi2.Connection'
object has no attribute 'autocommit'" in <bound method
Transaction.__del__ of <sqlobject.dbconnection.Transaction object at
0xa73be8cc>> ignored

I'm seeing it on Linux too.
TurboGears 0.9a4
SQLObject 0.7.1dev-r1588
pysqlite-2.1.3
sqlite 3.3.3

And this is the model I used (but maybe it's not a good model)

from sqlobject import *
from turbogears.database import PackageHub
# Uncomment the following line if you wish to use Identity and
SO_Provider

from turbogears.identity.soprovider import TG_User, TG_Group,
TG_Permission

hub = PackageHub("godot2")
__connection__ = hub

# class YourDataClass(SQLObject):
# pass

class Term(SQLObject):
term = StringCol(length=400,notNone=True)
definition = StringCol()
context = StringCol()
finalresult = StringCol(length=400)
status =
EnumCol(enumValues=['NEW','CONFIRMED','ATTENTION','FINISHED'])
created = DateTimeCol()
changed = DateTimeCol()
comments = MultipleJoin("Comment")
suggestions = MultipleJoin("Suggestion")


class Comment(SQLObject):
comment = StringCol(notNone=True)
created = DateTimeCol()
changed = StringCol()
term = ForeignKey("Term")


class Suggestion(SQLObject):
suggestion = StringCol(length=400,notNone=True)
points = IntCol()
created = DateTimeCol()
changed = DateTimeCol()
term = ForeignKey("Term")


class Veto(SQLObject):
suggestion = ForeignKey("Suggestion")
comment = ForeignKey("Comment")
user = ForeignKey("User")

Jorge Vargas

unread,
Apr 19, 2006, 10:16:52 AM4/19/06
to turbo...@googlegroups.com

3.3.4 at work, and i still get the bug so this is discarted.





Jorge Vargas

unread,
Apr 19, 2006, 10:24:02 AM4/19/06
to turbo...@googlegroups.com
I have found something interesting, could someone confirm.

There is no problems at all until I add a RelatedJoin to any class.

Also tg looks-up on that error and the only way to clear it is start a new project.

On 4/19/06, Damjan <gda...@gmail.com> wrote:

If we are talkin about this error:
godot2$ tg-admin sql create
Using database URI sqlite:///tmp/godot2.db
Exception exceptions.AttributeError: "'pysqlite2.dbapi2.Connection'
object has no attribute 'autocommit'" in <bound method
Transaction.__del__ of <sqlobject.dbconnection.Transaction object at
0xa73be8cc>> ignored

yes that's the error 

I'm seeing it on Linux too.
TurboGears 0.9a4
SQLObject 0.7.1dev-r1588
pysqlite-2.1.3
sqlite 3.3.3

ok so it's not a windows only thing, it got the same except sqlite (3.3.4)

Lets test something, create a new proy, copy your *.cfg files and your model.py comment out all the MultipleJoin and try running it.

if no error happen then the bug is related to the "extra" tables SQLObject creates.




Gerhard Häring

unread,
Apr 19, 2006, 10:28:47 AM4/19/06
to turbo...@googlegroups.com
Damjan wrote:
> If we are talkin about this error:
> godot2$ tg-admin sql create
> Using database URI sqlite:///tmp/godot2.db
> Exception exceptions.AttributeError: "'pysqlite2.dbapi2.Connection'
> object has no attribute 'autocommit'" in <bound method
> Transaction.__del__ of <sqlobject.dbconnection.Transaction object at
> 0xa73be8cc>> ignored [...]

I've debugged this and identified the part of SQLObject that's creating
problems here - and put a comment in the ticket:

http://trac.turbogears.org/turbogears/ticket/763

-- Gerhard

ienl...@gmail.com

unread,
Apr 26, 2006, 7:15:40 AM4/26/06
to TurboGears
just add the no_trans on the uri and the problem goes away.

sqlobject.dburi="notrans_sqlite:///Users/ienliven/Sites/frs-py/frs-sqlobject.db"

cheers,
andre souza

Jorge Vargas

unread,
Apr 26, 2006, 10:12:15 AM4/26/06
to turbo...@googlegroups.com
that's a good a workaroundm, not a fix.
Reply all
Reply to author
Forward
0 new messages