The Session doesn't interact with the database until statements are first
emitted, so while its being put into a new transaction each time with your
block of code, probably nothing is being sent to the DB. If you stuck a line:
s.execute("select 1") in there, that would likely wake it up.
On Jun 2, 2011, at 9:32 AM, Aalok Sood wrote:
> Hello Everyone
>
> My mysql server wait_timeout is set to 35.
> and if i run this code:
>
> # Session s made with autocommit=False
> mm=s.query(ss.Machine).get(1)
>
> In [9]:
>
> In [10]: for i in range(1000):
> : sleep(15)
> : print "commiting"
> : s.commit()
> : sleep(25)
> : mm.name=u'new name'
> : print "commiting2"
> : s.commit()
>
> Even though the second sleep is only for 25 seconds, I see an error
> while commiting which says
> 'Mysql server has gone away'
>
> The SQLAlchemy documentation says that a new transaction is begun on a
> commit(). If that is the case, I should not see the above error.
> Maybe its an issue with commiting w/o any changes to the loaded
> instances.
>
> Can anyone throw some light on this.
> Any help would be much appreciated.
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.