Пример #1
0
    def add_datapoint(
        self,
        point_order,
        measurement_id,
        tool_id,
        point_name_long,
        point_name_short,
        point_unit_name,
        point_value,
        point_measured,
    ):
        four_int_val = number_to_four_ints(point_value)
        # print 'POINT_VALUE:', point_value
        # print '4 INTS:', four_int_val

        ins = self.DataPoints.insert().values(
            point_order=point_order,
            measurement_id=measurement_id,
            tool_id=tool_id,
            point_name_long=point_name_long,
            point_name_short=point_name_short,
            point_unit_name=point_unit_name,
            point_sign=four_int_val[0],
            point_mantissa=four_int_val[1],
            point_exponent=four_int_val[2],
            point_bytecount=four_int_val[3],
            point_measured=point_measured,
        )
        ins.compile().params
        result = self.connection.execute(ins)
        return result.inserted_primary_key
Пример #2
0
 def add_datapoint_array(
     self,
     point_order,
     measurement_id,
     tool_id,
     point_name_long,
     point_name_short,
     point_unit_name,
     point_value,
     point_measured,
 ):
     four_int_val = number_to_four_ints(point_value)
     self.engine.execute(
         self.DataPoints.insert(),
         [
             {
                 "point_order": point_order[i],
                 "measurement_id": measurement_id,
                 "tool_id": tool_id,
                 "point_name_long": point_name_long,
                 "point_name_short": point_name_short,
                 "point_unit_name": point_unit_name,
                 "point_sign": four_int_val[i][0],
                 "point_mantissa": four_int_val[i][1],
                 "point_exponent": four_int_val[i][2],
                 "point_bytecount": four_int_val[i][3],
                 "point_measured": point_measured,
             }
             for i in range(point_value.size)
         ],
     )