@@ -165,12 +165,25 @@ def __repr__(self):
165165 return "<QueryFilter [{} {} {}]>" .format (self .column_name , self .filter_type , self .value )
166166
167167
168+ class AuditBehavior :
169+ """
170+ Enum of different auditing levels
171+ """
172+
173+ DETAILED = "DETAILED"
174+ NONE = "NONE"
175+ SUMMARY = "SUMMARY"
176+
177+
168178def delete_rows (
169179 server_context : ServerContext ,
170180 schema_name : str ,
171181 query_name : str ,
172182 rows : any ,
173183 container_path : str = None ,
184+ transacted : bool = True ,
185+ audit_behavior : AuditBehavior = None ,
186+ audit_user_comment : str = None ,
174187 timeout : int = _default_timeout ,
175188):
176189 """
@@ -180,12 +193,25 @@ def delete_rows(
180193 :param query_name: table name to delete from
181194 :param rows: Set of rows to delete
182195 :param container_path: labkey container path if not already set in context
196+ :param transacted: whether all of the updates should be done in a single transaction
197+ :param audit_behavior: used to override the audit behavior for the update. See class query.AuditBehavior
198+ :param audit_user_comment: used to provide a comment that will be attached to certain detailed audit log records
183199 :param timeout: timeout of request in seconds (defaults to 30s)
184200 :return:
185201 """
186202 url = server_context .build_url ("query" , "deleteRows.api" , container_path = container_path )
203+
187204 payload = {"schemaName" : schema_name , "queryName" : query_name , "rows" : rows }
188205
206+ if transacted is False :
207+ payload ["transacted" ] = transacted
208+
209+ if audit_behavior is not None :
210+ payload ["auditBehavior" ] = audit_behavior
211+
212+ if audit_user_comment is not None :
213+ payload ["auditUserComment" ] = audit_user_comment
214+
189215 return server_context .make_request (
190216 url ,
191217 json = payload ,
@@ -288,6 +314,10 @@ def insert_rows(
288314 query_name : str ,
289315 rows : List [any ],
290316 container_path : str = None ,
317+ skip_reselect_rows : bool = False ,
318+ transacted : bool = True ,
319+ audit_behavior : AuditBehavior = None ,
320+ audit_user_comment : str = None ,
291321 timeout : int = _default_timeout ,
292322):
293323 """
@@ -297,13 +327,29 @@ def insert_rows(
297327 :param query_name: table name to insert into
298328 :param rows: set of rows to insert
299329 :param container_path: labkey container path if not already set in context
330+ :param skip_reselect_rows: whether the full detailed response for the insert can be skipped
331+ :param transacted: whether all of the updates should be done in a single transaction
332+ :param audit_behavior: used to override the audit behavior for the update. See class query.AuditBehavior
333+ :param audit_user_comment: used to provide a comment that will be attached to certain detailed audit log records
300334 :param timeout: timeout of request in seconds (defaults to 30s)
301335 :return:
302336 """
303337 url = server_context .build_url ("query" , "insertRows.api" , container_path = container_path )
304338
305339 payload = {"schemaName" : schema_name , "queryName" : query_name , "rows" : rows }
306340
341+ if skip_reselect_rows is True :
342+ payload ["skipReselectRows" ] = skip_reselect_rows
343+
344+ if transacted is False :
345+ payload ["transacted" ] = transacted
346+
347+ if audit_behavior is not None :
348+ payload ["auditBehavior" ] = audit_behavior
349+
350+ if audit_user_comment is not None :
351+ payload ["auditUserComment" ] = audit_user_comment
352+
307353 return server_context .make_request (
308354 url ,
309355 json = payload ,
@@ -422,6 +468,9 @@ def update_rows(
422468 query_name : str ,
423469 rows : List [any ],
424470 container_path : str = None ,
471+ transacted : bool = True ,
472+ audit_behavior : AuditBehavior = None ,
473+ audit_user_comment : str = None ,
425474 timeout : int = _default_timeout ,
426475):
427476 """
@@ -432,13 +481,25 @@ def update_rows(
432481 :param query_name: table name to update
433482 :param rows: Set of rows to update
434483 :param container_path: labkey container path if not already set in context
484+ :param transacted: whether all of the updates should be done in a single transaction
485+ :param audit_behavior: used to override the audit behavior for the update. See class query.AuditBehavior
486+ :param audit_user_comment: used to provide a comment that will be attached to certain detailed audit log records
435487 :param timeout: timeout of request in seconds (defaults to 30s)
436488 :return:
437489 """
438490 url = server_context .build_url ("query" , "updateRows.api" , container_path = container_path )
439491
440492 payload = {"schemaName" : schema_name , "queryName" : query_name , "rows" : rows }
441493
494+ if transacted is False :
495+ payload ["transacted" ] = transacted
496+
497+ if audit_behavior is not None :
498+ payload ["auditBehavior" ] = audit_behavior
499+
500+ if audit_user_comment is not None :
501+ payload ["auditUserComment" ] = audit_user_comment
502+
442503 return server_context .make_request (
443504 url ,
444505 json = payload ,
@@ -461,10 +522,21 @@ def delete_rows(
461522 query_name : str ,
462523 rows : any ,
463524 container_path : str = None ,
525+ transacted : bool = True ,
526+ audit_behavior : AuditBehavior = None ,
527+ audit_user_comment : str = None ,
464528 timeout : int = _default_timeout ,
465529 ):
466530 return delete_rows (
467- self .server_context , schema_name , query_name , rows , container_path , timeout
531+ self .server_context ,
532+ schema_name ,
533+ query_name ,
534+ rows ,
535+ container_path ,
536+ transacted ,
537+ audit_behavior ,
538+ audit_user_comment ,
539+ timeout
468540 )
469541
470542 @functools .wraps (truncate_table )
@@ -512,10 +584,23 @@ def insert_rows(
512584 query_name : str ,
513585 rows : List [any ],
514586 container_path : str = None ,
587+ skip_reselect_rows : bool = False ,
588+ transacted : bool = True ,
589+ audit_behavior : AuditBehavior = None ,
590+ audit_user_comment : str = None ,
515591 timeout : int = _default_timeout ,
516592 ):
517593 return insert_rows (
518- self .server_context , schema_name , query_name , rows , container_path , timeout
594+ self .server_context ,
595+ schema_name ,
596+ query_name ,
597+ rows ,
598+ container_path ,
599+ skip_reselect_rows ,
600+ transacted ,
601+ audit_behavior ,
602+ audit_user_comment ,
603+ timeout
519604 )
520605
521606 @functools .wraps (select_rows )
@@ -571,8 +656,19 @@ def update_rows(
571656 query_name : str ,
572657 rows : List [any ],
573658 container_path : str = None ,
659+ transacted : bool = True ,
660+ audit_behavior : AuditBehavior = None ,
661+ audit_user_comment : str = None ,
574662 timeout : int = _default_timeout ,
575663 ):
576664 return update_rows (
577- self .server_context , schema_name , query_name , rows , container_path , timeout
665+ self .server_context ,
666+ schema_name ,
667+ query_name ,
668+ rows ,
669+ container_path ,
670+ transacted ,
671+ audit_behavior ,
672+ audit_user_comment ,
673+ timeout
578674 )
0 commit comments