I wish zope.transaction or something that replaced it would return a Session subclass that replaces .commit and .rollback with calls to transaction.commit and transaction.abort rather than raising an exception with one and silently doing the wrong thing with the other :-/

Chris

On 26/06/2013 11:54, Pau Tallada wrote:
Ok, that was my fault.

I was calling rollback() on a sqla.orm.session, instead of calling
transaction.abort()
Although the documentation only forbids calling commit, it does not say
anything about rolling back an individual session :(

Thanks!

Pau.

2013/6/25 Michael Bayer <[email protected]
<mailto:[email protected]>>

    looks like a zope.transaction issue to me, or at least one where
    they'd have to show me how they need to use the Session.  They seem
    to be calling upon session.transaction.prepare() directly at a time
    when that session.transaction is no longer associated with the
    parent session.   You'd need to take it up with the zope.transaction
    folks first.




    On Jun 25, 2013, at 5:49 AM, Pau Tallada <[email protected]
    <mailto:[email protected]>> wrote:

    Hi!

    I think I've stepped on the same or similar bug.

    I have a software which uses zodb transactions to synchronize
    operations in two databases. In the end, the two databases are the
    same (we are using the exact same postgresql connection url for
    both). The software runs fine if only one instance is launched.

    But... if I launch more than one instance at a time, there is a
    great possibility that I get an Exception like this:

    Traceback (most recent call last):
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/brownthrower/dispatcher/static/__init__.py",
    line 238, in _run_job
        transaction.commit()
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/transaction/_manager.py",
    line 111, in commit
        return self.get().commit()
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/transaction/_transaction.py",
    line 280, in commit
        reraise(t, v, tb)
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/transaction/_transaction.py",
    line 271, in commit
        self._commitResources()
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/transaction/_transaction.py",
    line 417, in _commitResources
        reraise(t, v, tb)
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/transaction/_transaction.py",
    line 394, in _commitResources
        rm.tpc_vote(self)
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/zope/sqlalchemy/datamanager.py",
    line 153, in tpc_vote
        self.tx.prepare()
      File
    
"/nfs/pau/PAUdm/codes/tonello/ENV/packaging_test/lib/python2.6/site-packages/sqlalchemy/orm/session.py",
    line 313, in prepare
        if self._parent is not None or not self.session.twophase:
    AttributeError: 'NoneType' object has no attribute 'twophase'

    I'm completely lost on this :(

    Any clues?

    BTW, sessions are created like this:

        engine = create_engine('postgresql://foo')
    session_maker = scoped_session(sessionmaker(
            bind = engine,
            twophase = True,
            extension = ZopeTransactionExtension()
        ))

    Thank you very much in advance :)

    Pau.

    2013/2/20 Michael Bayer <[email protected]
    <mailto:[email protected]>>

        you'd have to illustrate a working example of the code that
        causes that.


        On Feb 20, 2013, at 6:18 AM, Christian Démolis
        <[email protected]
        <mailto:[email protected]>> wrote:

        Hi,

        AttributeError:'NoneType'  object has no attribute'twophase'


        243.
        244.
        245.
        246.
        247.
        248.

        249.
        250.
        251.
        252.
                

                                 "Session already has a Connection associated for 
the"
                                 "given Connection's Engine")





                     else:
                         conn=bind.contextual_connect()






        if self.session.twophase and self._parent is None:






                     transaction=conn.begin_twophase()
                 elif self.nested:





                     transaction=conn.begin_nested()
                 else:


        Anybody understand this error ?

        --
        You received this message because you are subscribed to the
        Google Groups "sqlalchemy" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to [email protected]
        <mailto:[email protected]>.
        To post to this group, send email to
        [email protected] <mailto:[email protected]>.
        Visit this group at
        http://groups.google.com/group/sqlalchemy?hl=en.
        For more options, visit https://groups.google.com/groups/opt_out.




        --
        You received this message because you are subscribed to the
        Google Groups "sqlalchemy" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to [email protected]
        <mailto:sqlalchemy%[email protected]>.
        To post to this group, send email to
        [email protected] <mailto:[email protected]>.
        Visit this group at
        http://groups.google.com/group/sqlalchemy?hl=en.
        For more options, visit https://groups.google.com/groups/opt_out.





    --
    ----------------------------------
    Pau Tallada Crespí
    Dep. d'Astrofísica i Cosmologia
    Port d'Informació Científica (PIC)
    Tel: +34 93 586 8233 <tel:%2B34%2093%20586%208233>
    ----------------------------------


    --
    You received this message because you are subscribed to the Google
    Groups "sqlalchemy" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    Visit this group at http://groups.google.com/group/sqlalchemy.

    For more options, visit https://groups.google.com/groups/opt_out.



    --
    You received this message because you are subscribed to the Google
    Groups "sqlalchemy" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:sqlalchemy%[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    Visit this group at http://groups.google.com/group/sqlalchemy.

    For more options, visit https://groups.google.com/groups/opt_out.





--
----------------------------------
Pau Tallada Crespí
Dep. d'Astrofísica i Cosmologia
Port d'Informació Científica (PIC)
Tel: +34 93 586 8233
----------------------------------

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.



______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to