コード例 #1
0
ファイル: resultset_test.py プロジェクト: bralicea/Trades
    def test_point_from_cols_vals(self):
        """Test points from columns in TestResultSet object."""
        cols = ['col1', 'col2']
        vals = [1, '2']

        point = ResultSet.point_from_cols_vals(cols, vals)
        self.assertDictEqual(point, {'col1': 1, 'col2': '2'})
コード例 #2
0
    def test_point_from_cols_vals(self):
        cols = ['col1', 'col2']
        vals = [1, '2']

        point = ResultSet.point_from_cols_vals(cols, vals)
        self.assertDictEqual(
            point,
            {'col1': 1, 'col2': '2'}
        )
コード例 #3
0
ファイル: resultset_test.py プロジェクト: bbc/influxdb-python
    def test_point_from_cols_vals(self):
        """Test points from columns in TestResultSet object."""
        cols = ['col1', 'col2']
        vals = [1, '2']

        point = ResultSet.point_from_cols_vals(cols, vals)
        self.assertDictEqual(
            point,
            {'col1': 1, 'col2': '2'}
        )
コード例 #4
0
def influx_get_current(measurement, meter_id):
    client = connect_influx()
    raw = client.query(GET_CURRENT_QUERY.format(measurement, meter_id), epoch="m", database=settings.DATABASES['influx']['NAME']).raw
    if not raw['series']:
        raise UnknownParameter('Measurement \'{0}\' or energy meter with id \'{1}\' not in database.'.format(measurement, meter_id))

    response = {
        'measurement': raw['series'][0]['name'],
        'data': ResultSet.point_from_cols_vals(cols=raw['series'][0]['columns'], vals=raw['series'][0]['values'][0])
    }
    return response
コード例 #5
0
    def test_point_from_cols_vals(self):
        cols = ['col1', 'col2']
        vals = [1, '2']

        point = ResultSet.point_from_cols_vals(cols, vals)
        self.assertDictEqual(point, {'col1': 1, 'col2': '2'})