that's not SQLAlchemy, you're using this:
https://github.com/aio-libs/aiopg/blob/master/aiopg/sa/result.py#L205
On 03/15/2017 04:13 AM, Christian Barra wrote:
Hello,
I am trying to fetch the result of a query after an insert.
SQLAlchemy 1.16 and PostgreSQL 9.6
This is the code:
engine = self.request.app['db']
async with engine.acquire() as conn:
query = models.User.insert().values(email=email,
first_name=first_name, last_name=last_name, password=password).return_defaults()
result = await conn.execute(query)
id = result.returned_defaults['id']
print(id)
ad this is the error:
id = result.returned_defaults['id']
AttributeError: 'ResultProxy' object has no attribute 'returned_defaults'
The example from the docs is the
same
http://docs.sqlalchemy.org/en/rel_1_1/core/dml.html#sqlalchemy.sql.expression.ValuesBase.return_defaults,
apart from the async stuff
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and
Verifiable Example. See http://stackoverflow.com/help/mcve for a full
description.
---
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 sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.