the bulk_save_objects() method will use executemany() if possible but this has 
no impact on the behavior of a failing row.  cx_Oracle wil normally run all the 
parameter sets inside of executemany() inside of a single transaction and if 
any parameter set fails, the operation stops.  

if you'd like to use the special cx_Oracle "batcherrors" flag that's apparently 
present, work with the DBAPI cursor directly as per 
https://docs.sqlalchemy.org/en/13/core/connections.html#working-with-raw-dbapi-connections
 .

On Mon, Nov 23, 2020, at 10:48 AM, hara chaitanya wrote:
> Hello All,
> 
> I am new to using SQLAlchemy. I am trying to insert records into Oracle table 
> using "session.bulk_save_objects()" method. However it seems if one insert 
> statement fails it would rollback complete transaction. 
> 
>  Cx_oracle library helps achieve this by executemany method with batching 
> errors. I am looking for similar functionality using SQLAlchemy, is there a 
> method or configuration that would allow me to use efficient batching. 
> 
> Thanks in advance.
> 
> Thanks,
> hara.
> 

> -- 
> 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/0aa6c2e9-0737-4d2d-9a4e-bbe1daa6207an%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/0aa6c2e9-0737-4d2d-9a4e-bbe1daa6207an%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/5428e734-d824-428e-a09c-2328f263f935%40www.fastmail.com.

Reply via email to