@@ -507,6 +507,52 @@ def update_rows(
507507 )
508508
509509
510+ def move_rows (
511+ server_context : ServerContext ,
512+ target_container_path : str ,
513+ schema_name : str ,
514+ query_name : str ,
515+ rows : any ,
516+ container_path : str = None ,
517+ transacted : bool = True ,
518+ audit_behavior : AuditBehavior = None ,
519+ audit_user_comment : str = None ,
520+ timeout : int = _default_timeout ,
521+ ):
522+ """
523+ Move a set of rows from the schema.query
524+ :param server_context: A LabKey server context. See utils.create_server_context.
525+ :param target_container_path: target labkey container path for the move
526+ :param schema_name: schema of table
527+ :param query_name: table name to move from
528+ :param rows: Set of rows to move
529+ :param container_path: source labkey container path if not already set in context
530+ :param transacted: whether all of the updates should be done in a single transaction
531+ :param audit_behavior: used to override the audit behavior for the update. See class query.AuditBehavior
532+ :param audit_user_comment: used to provide a comment that will be attached to certain detailed audit log records
533+ :param timeout: timeout of request in seconds (defaults to 30s)
534+ :return:
535+ """
536+ url = server_context .build_url ("query" , "moveRows.api" , container_path = container_path )
537+
538+ payload = {"targetContainerPath" : target_container_path , "schemaName" : schema_name , "queryName" : query_name , "rows" : rows }
539+
540+ if transacted is False :
541+ payload ["transacted" ] = transacted
542+
543+ if audit_behavior is not None :
544+ payload ["auditBehavior" ] = audit_behavior
545+
546+ if audit_user_comment is not None :
547+ payload ["auditUserComment" ] = audit_user_comment
548+
549+ return server_context .make_request (
550+ url ,
551+ json = payload ,
552+ timeout = timeout ,
553+ )
554+
555+
510556class QueryWrapper :
511557 """
512558 Wrapper for all of the API methods exposed in the query module. Used by the APIWrapper class.
@@ -672,3 +718,29 @@ def update_rows(
672718 audit_user_comment ,
673719 timeout
674720 )
721+
722+ @functools .wraps (move_rows )
723+ def move_rows (
724+ self ,
725+ target_container_path : str ,
726+ schema_name : str ,
727+ query_name : str ,
728+ rows : any ,
729+ container_path : str = None ,
730+ transacted : bool = True ,
731+ audit_behavior : AuditBehavior = None ,
732+ audit_user_comment : str = None ,
733+ timeout : int = _default_timeout ,
734+ ):
735+ return move_rows (
736+ self .server_context ,
737+ target_container_path ,
738+ schema_name ,
739+ query_name ,
740+ rows ,
741+ container_path ,
742+ transacted ,
743+ audit_behavior ,
744+ audit_user_comment ,
745+ timeout
746+ )
0 commit comments