2121import org .labkey .api .query .FieldKey ;
2222import org .labkey .api .query .InvalidKeyException ;
2323import org .labkey .api .query .QueryService ;
24+ import org .labkey .api .query .QueryUpdateService ;
2425import org .labkey .api .query .QueryUpdateServiceException ;
2526import org .labkey .api .query .UserSchema ;
2627import org .labkey .api .reader .Readers ;
@@ -74,6 +75,8 @@ private void processFile(PipelineJob job) throws PipelineJobException
7475 {
7576 throw new PipelineJobException ("Unable to find table: clinical observations" );
7677 }
78+ QueryUpdateService qus = clinicalObs .getUpdateService ();
79+ qus .setBulkLoad (true );
7780
7881 final List <Map <String , Object >> toInsert = new ArrayList <>();
7982 final List <Map <String , Object >> toUpdate = new ArrayList <>();
@@ -156,7 +159,7 @@ private void processFile(PipelineJob job) throws PipelineJobException
156159 job .getLogger ().info ("Deleting " + toDelete .size () + " rows" );
157160 try
158161 {
159- clinicalObs . getUpdateService () .deleteRows (_containerUser .getUser (), _containerUser .getContainer (), toDelete , null , null );
162+ qus .deleteRows (_containerUser .getUser (), _containerUser .getContainer (), toDelete , null , null );
160163 }
161164 catch (InvalidKeyException | BatchValidationException | QueryUpdateServiceException | SQLException e )
162165 {
@@ -170,7 +173,7 @@ private void processFile(PipelineJob job) throws PipelineJobException
170173 try
171174 {
172175 BatchValidationException bve = new BatchValidationException ();
173- clinicalObs . getUpdateService () .insertRows (_containerUser .getUser (), _containerUser .getContainer (), toInsert , bve , null , null );
176+ qus .insertRows (_containerUser .getUser (), _containerUser .getContainer (), toInsert , bve , null , null );
174177 if (bve .hasErrors ())
175178 {
176179 throw bve ;
@@ -192,7 +195,7 @@ private void processFile(PipelineJob job) throws PipelineJobException
192195 try
193196 {
194197 List <Map <String , Object >> oldKeys = toUpdate .stream ().map (x -> Map .of ("objectid" , x .get ("objectid" ))).collect (Collectors .toList ());
195- clinicalObs . getUpdateService () .updateRows (_containerUser .getUser (), _containerUser .getContainer (), toUpdate , oldKeys , null , null );
198+ qus .updateRows (_containerUser .getUser (), _containerUser .getContainer (), toUpdate , oldKeys , null , null );
196199 }
197200 catch (QueryUpdateServiceException | SQLException | BatchValidationException | InvalidKeyException e )
198201 {
0 commit comments