My use case requires that if insertion of object of Myclass succeeds
then insert Object of Myclass1 .
Even if inserting of Myclass1 object fails insertion of Myclass should
not be rolled back.
I mean adding Myclass is permanent and does not depend on failure or
success of insertion of Myclass1.
I h
Jonathan,
You probably want transaction.savepoint() in that case. There's a pretty
extensive discussion here showing savepoints (and rollbacks to savepoints)
as a way of creating sub-transactions with pyramid_tm:
https://groups.google.com/d/msg/pylons-discuss/5Mj4R3YMXhI/GVFj2Du33JAJ
You can of
On Tue, Feb 14, 2012 at 7:19 PM, Jonathan Vanasco wrote:
> could anyone point in the right direction to either:
>
> 1. rebind an object to a new session
> or
> 2. allow objects to still be 'read' in the detached state ?
Eric said it best: replace commit with DBSession.flush()
--
You received th
eric-
thanks. I'll post a followup on the pylons list.
i've already got a call to session.flush()
the problem is that i need the transaction itself committed in this
block. i have a series of "database transactions" that happen within
the request. the first "database transaction" should error
could anyone point in the right direction to either:
1. rebind an object to a new session
or
2. allow objects to still be 'read' in the detached state ?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalche
that seems to be it...
when you commit, there is a call to _finish()
http://www.zodb.org/zodbbook/transactions.html#commit
_finish() is documented under abort()
http://www.zodb.org/zodbbook/transactions.html#abort
and it includes a session.close()
--
You received this message because yo
Hi Jonathan,
It's pyramid_tm -- it will clear the session on commit. It's
counter-intuitive (or at least it was for me) if you've spent a lot of time
with SQLAlchemy and using sessions directly, but you should try flush
instead of commit:
print userInstance.id
DBSession.flush()
my stuff doesn't handle the transaction commit - that's purely
transaction / pyramid_tm
so i'll look into that code to see if its closing it. great lead,
thanks.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email t
On Tue, Feb 14, 2012 at 6:48 PM, Jonathan Vanasco wrote:
> I will admit that i have some janky db sessioning stuff going on
> behind the scenes as I get used to pyramid and the new sqlalchemy.
Then I'd say the "janky db sessioning stuff going on behind the
scenes" is closing your session after th
I seem to get this after I call a transaction.commit
sqlalchemy.orm.exc.DetachedInstanceError
DetachedInstanceError: Instance is
not bound to a Session; attribute refresh operation cannot proceed
In the following code, the first call will print the id [ i called a
flush() previously ],
Ah!
Cool, that makes sense.
Changed the code to:
# query = db.query(User).options(subqueryload(User.web_login),
subqueryload(User.facebook_connect))
Upgraded to 0.7.5. And that did the trick, now both tables are loaded
as subqueries.
Thank you Michael!
Much appreciated!
/JT
On Feb 13, 4:44 pm
11 matches
Mail list logo