@@ -792,56 +792,12 @@ def writeToApdb(self, updatedDiaObjects, associatedDiaSources, diaForcedSources)
792
792
diaObjectStore = dropEmptyColumns (self .schema , updatedDiaObjects , tableName = "DiaObject" )
793
793
diaSourceStore = dropEmptyColumns (self .schema , associatedDiaSources , tableName = "DiaSource" )
794
794
diaForcedSourceStore = dropEmptyColumns (self .schema , diaForcedSources , tableName = "DiaForcedSource" )
795
-
796
- nObject = len (diaObjectStore )
797
- nSource = len (diaSourceStore )
798
- nForced = len (diaForcedSourceStore )
799
- nRecords = max (nObject , nSource , nForced )
800
- nWritten = 0
801
- start = 0
802
- if self .config .maximumTableLength > 0 :
803
- maximumTableLength = self .config .maximumTableLength
804
- else :
805
- maximumTableLength = nRecords
806
- end = min (nRecords , maximumTableLength )
807
- time = DateTime .now ().toAstropy ()
808
- while nWritten < nRecords :
809
- srcEnd = min (start + maximumTableLength , nSource )
810
- if srcEnd <= start :
811
- finalDiaSources = None
812
- nSourceChunk = 0
813
- else :
814
- finalDiaSources = diaSourceStore .iloc [start :srcEnd ].copy ()
815
- nSourceChunk = srcEnd - start
816
-
817
- fSrcEnd = min (start + maximumTableLength , nForced )
818
- if fSrcEnd <= start :
819
- finalForcedSources = None
820
- nForcedChunk = 0
821
- else :
822
- finalForcedSources = diaForcedSourceStore .iloc [start :fSrcEnd ].copy ()
823
- nForcedChunk = fSrcEnd - start
824
- objEnd = min (start + maximumTableLength , nObject )
825
- if objEnd <= start :
826
- finalDiaObjects = None
827
- nObjectChunk = 0
828
- else :
829
- finalDiaObjects = diaObjectStore .iloc [start :end ].copy ()
830
- nObjectChunk = fSrcEnd - start
831
-
832
- self .log .info ("Writing %i/%i diaObjects, %i/%i diaSources and %i/%i diaForcedSources to the APDB" ,
833
- nObjectChunk , nObject ,
834
- nSourceChunk , nSource ,
835
- nForcedChunk , nForced ,
836
- )
837
- self .apdb .store (
838
- time ,
839
- finalDiaObjects ,
840
- finalDiaSources ,
841
- finalForcedSources )
842
- nWritten += end - start
843
- start = end + 1
844
- end = min (nRecords , start + maximumTableLength )
795
+ self .apdb .store (
796
+ DateTime .now ().toAstropy (),
797
+ diaObjectStore ,
798
+ diaSourceStore ,
799
+ diaForcedSourceStore ,
800
+ maximum_table_length = self .config .maximumTableLength )
845
801
self .log .info ("APDB updated." )
846
802
847
803
def testDataFrameIndex (self , df ):
0 commit comments