executemany() with batcherrors=True still raising an exception #418
-
I'm trying to write a function for inserting data with executemany(). I would like it to fail rows that have for example incorrect data type. If I modify a data row to contain Is this expected behavior? I'm using oracledb 1.1.1. Below is my code and raised error. connection = create_oracle_connection()
cursor = connection.cursor()
cursor.setinputsizes(**dtype)
bind_columns = "(:" + ", :".join(str(col) for col in data[0].keys()) + ")"
data[1]["SHC_COUNT"] = "e2eedw"
cursor.executemany(
statement=f"insert into {schema}.{table} values {bind_columns}",
parameters=data[0:2],
batcherrors=True,
)
error_rows = len(cursor.getbatcherrors())
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, this is the expected behavior. The batch errors support is with respect to the response from the server. It can't work unless all of the data is sent at once. A method that checks the data (perhaps returns something equivalent to a DataFrame?) and gives you information about which rows and columns have issues would be possible, but not something that is available today. |
Beta Was this translation helpful? Give feedback.
Yes, this is the expected behavior. The batch errors support is with respect to the response from the server. It can't work unless all of the data is sent at once. A method that checks the data (perhaps returns something equivalent to a DataFrame?) and gives you information about which rows and columns have issues would be possible, but not something that is available today.