def _save_results(self, connection, map_pixel_results, list_insert_filters, list_pixel_parameters, map_pixel_histograms): """ Add the pixel to the database """ if self._pxresult_id is not None and not self.noinsert: # Update the filters connection.execute(PIXEL_RESULT.update().where( PIXEL_RESULT.c.pxresult_id == self._pxresult_id).values( map_pixel_results)) connection.execute(PIXEL_FILTER.insert(), list_insert_filters) # Because I need to get the PK back we have to do each one separately for pixel_parameter in list_pixel_parameters: result = connection.execute(PIXEL_PARAMETER.insert(), pixel_parameter) id = result.inserted_primary_key # Add the ID to the list list_pixel_histograms = map_pixel_histograms[ pixel_parameter['parameter_name_id']] for map_values in list_pixel_histograms: map_values['pxparameter_id'] = id[0] connection.execute(PIXEL_HISTOGRAM.insert(), list_pixel_histograms)
def _save_results(self, map_pixel_results): """ Add the pixel to the database """ if self._pxresult_id is not None and not self.noinsert: # Update the filters self._database_queue.append(PIXEL_RESULT.update().where(PIXEL_RESULT.c.pxresult_id == self._pxresult_id).values(map_pixel_results))
def _save_results(self, connection, map_pixel_results): """ Add the pixel to the database """ if self._pxresult_id is not None and not self.noinsert: # Update the filters connection.execute(PIXEL_RESULT.update().where(PIXEL_RESULT.c.pxresult_id == self._pxresult_id).values(map_pixel_results))
def _save_results(self, connection, map_pixel_results): """ Add the pixel to the database """ if self._pxresult_id is not None and not self.noinsert: # Update the filters connection.execute(PIXEL_RESULT.update().where(PIXEL_RESULT.c.pxresult_id == self._pxresult_id).values(map_pixel_results))
def lock(time_p): connection = ENGINE.connect() transaction = connection.begin() i = 999 while True: wu_id = random.randrange(5, 60, 1) connection.execute(AREA.update().where(AREA.c.area_id == wu_id).values( workunit_id=wu_id, update_time=datetime.datetime.now())) connection.execute(PIXEL_RESULT.update().where( PIXEL_RESULT.c.pxresult_id == wu_id).values(y=i, x=i)) i += 1 if i > 100000: break transaction.rollback()
def lock(time_p): connection = ENGINE.connect() transaction = connection.begin() i = 999 while True: wu_id = random.randrange(5, 60, 1) connection.execute( AREA.update() .where(AREA.c.area_id == wu_id) .values(workunit_id=wu_id, update_time=datetime.datetime.now())) connection.execute(PIXEL_RESULT.update().where(PIXEL_RESULT.c.pxresult_id == wu_id).values(y=i, x=i)) i += 1 if i > 100000: break transaction.rollback()
def _save_results(self, connection, map_pixel_results, list_insert_filters, list_pixel_parameters, map_pixel_histograms): """ Add the pixel to the database """ if self._pxresult_id is not None and not self.noinsert: # Update the filters connection.execute(PIXEL_RESULT.update().where(PIXEL_RESULT.c.pxresult_id == self._pxresult_id).values(map_pixel_results)) connection.execute(PIXEL_FILTER.insert(), list_insert_filters) # Because I need to get the PK back we have to do each one separately for pixel_parameter in list_pixel_parameters: result = connection.execute(PIXEL_PARAMETER.insert(), pixel_parameter) id = result.inserted_primary_key # Add the ID to the list list_pixel_histograms = map_pixel_histograms[pixel_parameter['parameter_name_id']] for map_values in list_pixel_histograms: map_values['pxparameter_id'] = id[0] connection.execute(PIXEL_HISTOGRAM.insert(), list_pixel_histograms)