From 6ec779d4a17f29a10f3e5ef1a342b4dd822c54c9 Mon Sep 17 00:00:00 2001 From: aviau Date: Mon, 23 Feb 2015 09:01:41 -0500 Subject: [PATCH 1/2] Bumped version to 0.3.1 --- influxdb/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/influxdb/__init__.py b/influxdb/__init__.py index 274366e6..adb789b2 100644 --- a/influxdb/__init__.py +++ b/influxdb/__init__.py @@ -11,4 +11,4 @@ ] -__version__ = '0.3.0' +__version__ = '0.3.1' From cdbf1bf4d7f53b1e70db53360fb18fb694cb0761 Mon Sep 17 00:00:00 2001 From: areski Date: Tue, 10 Mar 2015 13:58:24 +0100 Subject: [PATCH 2/2] fix clarity in tutorial Series Helper --- examples/tutorial_serieshelper.py | 42 +++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/examples/tutorial_serieshelper.py b/examples/tutorial_serieshelper.py index ed3f155a..d7bd27c9 100644 --- a/examples/tutorial_serieshelper.py +++ b/examples/tutorial_serieshelper.py @@ -1,29 +1,49 @@ +""" +Tutorial/Example how to use the class helper `SeriesHelper` +""" + from influxdb import InfluxDBClient from influxdb import SeriesHelper +# InfluxDB connections settings +host = 'localhost' +port = 8086 +user = 'root' +password = 'root' +dbname = 'mydb' + +myclient = InfluxDBClient(host, port, user, password, dbname) + +# Uncomment the following code if the database is not yet created +# myclient.create_database(dbname) +# myclient.create_retention_policy('awesome_policy', '3d', 3, default=True) + class MySeriesHelper(SeriesHelper): + # Meta class stores time series helper configuration. class Meta: - # Meta class stores time series helper configuration. - client = InfluxDBClient() # The client should be an instance of InfluxDBClient. - series_name = 'events.stats.{server_name}' + client = myclient # The series name must be a string. Add dependent fields/tags in curly brackets. - fields = ['some_stat'] + series_name = 'events.stats.{server_name}' # Defines all the fields in this time series. - tags = ['server_name'] + fields = ['some_stat', 'other_stat'] # Defines all the tags for the series. - bulk_size = 5 + tags = ['server_name'] # Defines the number of data points to store prior to writing on the wire. + bulk_size = 5 + # autocommit must be set to True when using bulk_size + autocommit = True + # The following will create *five* (immutable) data points. # Since bulk_size is set to 5, upon the fifth construction call, *all* data # points will be written on the wire via MySeriesHelper.Meta.client. -MySeriesHelper(server_name='us.east-1', some_stat=159) -MySeriesHelper(server_name='us.east-1', some_stat=158) -MySeriesHelper(server_name='us.east-1', some_stat=157) -MySeriesHelper(server_name='us.east-1', some_stat=156) -MySeriesHelper(server_name='us.east-1', some_stat=155) +MySeriesHelper(server_name='us.east-1', some_stat=159, other_stat=10) +MySeriesHelper(server_name='us.east-1', some_stat=158, other_stat=20) +MySeriesHelper(server_name='us.east-1', some_stat=157, other_stat=30) +MySeriesHelper(server_name='us.east-1', some_stat=156, other_stat=40) +MySeriesHelper(server_name='us.east-1', some_stat=155, other_stat=50) # To manually submit data points which are not yet written, call commit: MySeriesHelper.commit()