Oh, on more question:

might there be anything inherently wrong with the scoped_session approach 
that i showed in the code snippets above?

CL

On Saturday, February 1, 2014 1:25:27 PM UTC+1, lars van gemerden wrote:
>
> Thanks, this helps some to narrow it down.
>
> Trying to zoom in:
>
> - why would sqla try to UPDATE (instead of INSERT) a row in the database, 
> when the row/object was never committed before?
> - when you flush an object to the database and then close the session that 
> flushed (no commit), what happens to the flushed data?
> - if an object is in a session and it has_identity, why would accessing 
> obj.id (id is the primary key) fail (see above)? 
> - Is there (in principle) a problem with:
>          + having an object of a mapped class which was never committed 
> (but maybe was added to a session and flushed, after which the session was 
> closed)
>          + setting an attribute of that object with another object that 
> was queried from the database
>          + committing the first object to the database?
>
> Cheers, Lars
>
> On Saturday, February 1, 2014 3:42:09 AM UTC+1, Michael Bayer wrote:
>>
>>
>> On Jan 31, 2014, at 8:11 PM, lars van gemerden <[email protected]> 
>> wrote:
>>
>>
>> "this means an object was meant to be UPDATEed via the ORM, however the 
>> row which is the target of the UPDATE is missing.  Either the primary key 
>> of this row changed somehow, or the row was deleted, *or* the row is not 
>> visible to your transaction (this seems to be your case)."
>>
>> -  could the error also occur when the object was never committed to the 
>> database (which seems to be the case; the commit where the error occurs 
>> should be the first time the Company object is committed to the database)?
>>
>>
>> sure
>>
>> -  this seems to suggest that it is possible that a row is in the 
>> database, but that it is not visible to a transaction; is that possible?
>>
>>
>> absolutely, the link http://en.wikipedia.org/wiki/Transaction_isolation is 
>> relevant here
>>
>>
>>

-- 
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