File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -204,23 +204,24 @@ Dictionary. Current available keys are:
204204 },
205205 ```
206206
207- - has_trigger
207+ - return_rows_bulk_insert
208208
209209 Boolean. Sets if backend can return rows from bulk insert.
210- Default value is False which allows for the backend to
211- return rows from bulk insert.
210+ Default value is False which doesn' t allows for the backend to
211+ return rows from bulk insert. Must be set to False if database
212+ has tables with triggers to prevent errors when inserting.
212213
213214 ```python
214215 # Examples
215216 " OPTIONS" : {
216- # This database has triggers so set has_trigger to True
217- # to prevent errors related to returning rows from bulk insert
218- " has_trigger " : True
217+ # This database doesn't have any triggers so can use return
218+ # rows from bulk insert feature
219+ " return_rows_bulk_insert " : True
219220 }
220221
221222 " OPTIONS" : {
222- # This database doesn't have any triggers so don't need to
223- # add has_trigger since it is False by default
223+ # This database has triggers so leave return_rows_bulk_insert as blank (False)
224+ # to prevent errors related to inserting and returning rows from bulk insert
224225 }
225226 ```
226227
Original file line number Diff line number Diff line change @@ -424,10 +424,10 @@ def init_connection_state(self):
424424 datefirst = options .get ('datefirst' , 7 )
425425 cursor .execute ('SET DATEFORMAT ymd; SET DATEFIRST %s' % datefirst )
426426
427- # If there are triggers set can_return_rows_from_bulk_insert to
428- # False to prevent errors when inserting . See issue #130
429- if (options .get ('has_trigger ' , False )):
430- self .features_class .can_return_rows_from_bulk_insert = False
427+ # Let user choose if driver can return rows from bulk insert since
428+ # inserting into tables with triggers causes errors . See issue #130
429+ if (options .get ('return_rows_bulk_insert ' , False )):
430+ self .features_class .can_return_rows_from_bulk_insert = True
431431
432432 val = self .get_system_datetime ()
433433 if isinstance (val , str ):
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
1212 can_introspect_small_integer_field = True
1313 can_return_columns_from_insert = True
1414 can_return_id_from_insert = True
15- can_return_rows_from_bulk_insert = True
15+ can_return_rows_from_bulk_insert = False
1616 can_rollback_ddl = True
1717 can_use_chunked_reads = False
1818 for_update_after_from = True
You can’t perform that action at this time.
0 commit comments