this is likely
http://docs.sqlalchemy.org/en/rel_1_0/changelog/migration_10.html#the-insert-from-select-construct-now-implies-inline-true
- use explicit returning().  returned_defaults implies only a single row
INSERT which is not the case for INSERT from SELECT.




On 11/01/2015 01:29 AM, gbr wrote:
> I've just tried to upgrade from 0.9.4 to the latest 1.0.9 version (yes,
> I'm late) and am running into some problems. Most notably,
> `returned_defaults` from an insert query does not seem to work as
> before. This is part of my code:
> 
>     new_record = select([user_id, parent_id, 1 + func.max(some_table.c.id)])
>     qry = insert(revision_table).from_select(
>         ['user_id', 'parent_id', 'id'],
>         new_record
>     ).return_defaults()
>     result = session.execute(qry)
>     new_id = result.returned_defaults['id']
>    
>   File "/python2.7/site-packages/sqlalchemy/engine/result.py", line 822,
> in returned_defaults
>     return self.context.returned_defaults
> AttributeError: 'PGExecutionContext_psycopg2' object has no attribute
> 'returned_defaults'
> 
> I've also upgraded psycopg2 to the latest, but the issue remains.
> `session` is a sqlalchemy.orm.scoping.scoped_session object.
> 
> Hope this information is enough and someone can help.
> 
> Thanks.
> 
> -- 
> 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/d/optout.

-- 
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/d/optout.

Reply via email to