Jacob Gabrielson | 14 May 21:44

Savepoints not generated with MySQL?


Hi,

I'm testing out the below script with MySQL 5.0.51a and SA 0.4.6.
Based on the documentation I expected to see a SAVEPOINT be created
(at some point) and rolled-back to but instead I get the following:

>>> satest.doit()
2008-05-14 12:42:37,813 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc BEGIN
2008-05-14 12:42:37,814 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc INSERT INTO test_table (name) VALUES (%s)
2008-05-14 12:42:37,814 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc ['outer']
2008-05-14 12:42:37,815 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc INSERT INTO test_table (name) VALUES (%s)
2008-05-14 12:42:37,815 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc ['inner']
2008-05-14 12:42:37,816 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc COMMIT

Am I doing something wrong?  I looked thru this mailing-list, bug
reports and documentation but couldn't see anything obvious.

Thanks!

-- Jacob

The script is:

(Continue reading)

Michael Bayer | 14 May 22:12

Re: Savepoints not generated with MySQL?


two problems:

1. the "threadlocal" mode, not a widely used option, currently does  
not support begin_nested() (which is somewhat of a surprise to me)
2. the inner() method issues no SQL.  add a "sess.flush()" in there,  
and do away with "threadlocal" to see it work.

On May 14, 2008, at 3:45 PM, Jacob Gabrielson wrote:

> from sqlalchemy import *
> from sqlalchemy.orm import *
>
> engine = create_engine('mysql://root <at> localhost/test', echo=True,
> strategy='threadlocal')
> meta = MetaData()
> meta.bind = engine
>
> test_table = Table('test_table', meta,
>                   Column('test_id', Integer, primary_key=True),
>                   Column('name', String(40)),
>                   mysql_engine='InnoDB')
>
> meta.create_all()
>
> class MyTest(object):
>    def __init__(self, test_name):
>        self.name = test_name
>
>
(Continue reading)

Jacob Gabrielson | 14 May 23:05

Re: Savepoints not generated with MySQL?


Hi,

Those changes fixed it!  It's a pretty minor issue, but would it make
sense for SA to log a warning when you try to use begin_nested() in a
scenario that doesn't support it?

Also, is the 'threadlocal' mode likely ever to support
begin_nested()?  I'm not sure I really will end up needing it, but I
was thinking I might need to mix in some 'implicit session' type code
at some point.

Thanks,

-- Jacob

On May 14, 1:12 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> two problems:
>
> 1. the "threadlocal" mode, not a widely used option, currently does  
> not support begin_nested() (which is somewhat of a surprise to me)
> 2. the inner() method issues no SQL.  add a "sess.flush()" in there,  
> and do away with "threadlocal" to see it work.
>
> On May 14, 2008, at 3:45 PM, Jacob Gabrielson wrote:
>
> > from sqlalchemy import *
> > from sqlalchemy.orm import *
>
> > engine = create_engine('mysql://root <at> localhost/test', echo=True,
(Continue reading)

Michael Bayer | 15 May 00:23

Re: Savepoints not generated with MySQL?


On May 14, 2008, at 5:05 PM, Jacob Gabrielson wrote:

>
> Hi,
>
> Those changes fixed it!  It's a pretty minor issue, but would it make
> sense for SA to log a warning when you try to use begin_nested() in a
> scenario that doesn't support it?

yea I added an NotImplementedError for that in r4758

> Also, is the 'threadlocal' mode likely ever to support
> begin_nested()?  I'm not sure I really will end up needing it, but I
> was thinking I might need to mix in some 'implicit session' type code
> at some point.

it can be done but we'd have to rework the internals of the  
Threadlocal module to work like the SessionTransaction.  The Session  
is already doing pretty much the same work as the Threadlocal module  
in this case (i.e. a single point of transaction control with nesting).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to sqlalchemy <at> googlegroups.com
To unsubscribe from this group, send email to sqlalchemy-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

(Continue reading)


Gmane