How to use the influxdb.influxdb08.client.InfluxDBClient function in influxdb

To help you get started, we’ve selected a few influxdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github influxdata / influxdb-python / influxdb / influxdb08 / dataframe_client.py View on Github external
time_precision = kwargs.get('time_precision', 's')
        if batch_size:
            kwargs.pop('batch_size')  # don't hand over to InfluxDBClient
            for key, data_frame in data.items():
                number_batches = int(math.ceil(
                    len(data_frame) / float(batch_size)))
                for batch in range(number_batches):
                    start_index = batch * batch_size
                    end_index = (batch + 1) * batch_size
                    outdata = [
                        self._convert_dataframe_to_json(
                            name=key,
                            dataframe=data_frame
                            .iloc[start_index:end_index].copy(),
                            time_precision=time_precision)]
                    InfluxDBClient.write_points(self, outdata, *args, **kwargs)
            return True

        outdata = [
            self._convert_dataframe_to_json(name=key, dataframe=dataframe,
                                            time_precision=time_precision)
            for key, dataframe in data.items()]
        return InfluxDBClient.write_points(self, outdata, *args, **kwargs)
github influxdata / influxdb-python / influxdb / influxdb08 / dataframe_client.py View on Github external
start_index = batch * batch_size
                    end_index = (batch + 1) * batch_size
                    outdata = [
                        self._convert_dataframe_to_json(
                            name=key,
                            dataframe=data_frame
                            .iloc[start_index:end_index].copy(),
                            time_precision=time_precision)]
                    InfluxDBClient.write_points(self, outdata, *args, **kwargs)
            return True

        outdata = [
            self._convert_dataframe_to_json(name=key, dataframe=dataframe,
                                            time_precision=time_precision)
            for key, dataframe in data.items()]
        return InfluxDBClient.write_points(self, outdata, *args, **kwargs)
github influxdata / influxdb-python / influxdb / influxdb08 / client.py View on Github external
raise ValueError('Unknown modifier "{0}".'.format(modifier))

        if conn_params.hostname:
            init_args['host'] = conn_params.hostname
        if conn_params.port:
            init_args['port'] = conn_params.port
        if conn_params.username:
            init_args['username'] = conn_params.username
        if conn_params.password:
            init_args['password'] = conn_params.password
        if conn_params.path and len(conn_params.path) > 1:
            init_args['database'] = conn_params.path[1:]

        init_args.update(kwargs)

        return InfluxDBClient(**init_args)
github influxdata / influxdb-python / influxdb / influxdb08 / dataframe_client.py View on Github external
# -*- coding: utf-8 -*-
"""DataFrame client for InfluxDB v0.8."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import math
import warnings

from .client import InfluxDBClient


class DataFrameClient(InfluxDBClient):
    """Primary defintion of the DataFrameClient for v0.8.

    The ``DataFrameClient`` object holds information necessary to connect
    to InfluxDB. Requests can be made to InfluxDB directly through the client.
    The client reads and writes from pandas DataFrames.
    """

    def __init__(self, ignore_nan=True, *args, **kwargs):
        """Initialize an instance of the DataFrameClient."""
        super(DataFrameClient, self).__init__(*args, **kwargs)

        try:
            global pd
            import pandas as pd
        except ImportError as ex:
            raise ImportError('DataFrameClient requires Pandas, '