Re: [sqlalchemy] Event: do_orm_execute inserted value

2023-09-20 Thread Tomas Pavlovsky
Thank you.

środa, 20 września 2023 o 15:54:42 UTC+2 Mike Bayer napisał(a):

> for a statement like that where the values are embedded in the insert() 
> construct directly you would use:
>
>  orm_execute_state.statement.compile().params
>
> this is mentioned in the tutorial at 
> https://docs.sqlalchemy.org/en/20/tutorial/data_insert.html#the-insert-sql-expression-construct
>  
>
> otherwise if parameters are sent separately, they are in 
> orm_execute_state.parameters
>
>
>
> On Wed, Sep 20, 2023, at 8:37 AM, Tomas Pavlovsky wrote:
>
> Hi Mike,
>
> how to access inserted value in do_orm_execute? 
> Event "before_insert" has "target" parameter, but how to do it in 
> do_orm_execute?
> session.execute(insert(User).values(name="name"))
> I need to access name value but don't know how?
> Thanks
>
>
>
> -- 
> 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+...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/9bea7c27-f67b-4d87-ab5e-71ece8c1dd46n%40googlegroups.com
>  
> 
> .
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/fb85ca42-0a48-4aba-814e-d392f11a12b0n%40googlegroups.com.


Re: [sqlalchemy] Event: do_orm_execute inserted value

2023-09-20 Thread Mike Bayer
for a statement like that where the values are embedded in the insert() 
construct directly you would use:

 orm_execute_state.statement.compile().params

this is mentioned in the tutorial at 
https://docs.sqlalchemy.org/en/20/tutorial/data_insert.html#the-insert-sql-expression-construct
 

otherwise if parameters are sent separately, they are in 
orm_execute_state.parameters



On Wed, Sep 20, 2023, at 8:37 AM, Tomas Pavlovsky wrote:
> Hi Mike,
> 
> how to access inserted value in do_orm_execute? 
> Event "before_insert" has "target" parameter, but how to do it in 
> do_orm_execute?
> session.execute(insert(User).values(name="name"))
> I need to access name value but don't know how?
> Thanks
> 
> 
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/9bea7c27-f67b-4d87-ab5e-71ece8c1dd46n%40googlegroups.com
>  
> .

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/7aa3f480-6266-437d-aab6-d2e1c3413f79%40app.fastmail.com.