Skip to content

Commit 54da635

Browse files
committed
Merge remote-tracking branch 'influxdb/master'
2 parents d086aa7 + a7ba64f commit 54da635

37 files changed

+1105
-948
lines changed

.travis.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@ env:
1010
- TOX_ENV=flake8
1111
- TOX_ENV=coverage
1212
install:
13-
- sudo pip install tox
14-
- sudo pip install coveralls
15-
- wget http://get.influxdb.org/influxdb_0.9.0-rc26_amd64.deb && sudo dpkg -i influxdb_0.9.0-rc26_amd64.deb
13+
- pip install tox
14+
- pip install coveralls
15+
- mkdir influxdb_install
16+
- wget https://s3.amazonaws.com/influxdb/influxdb_0.9.2_amd64.deb
17+
- dpkg -x influxdb_*_amd64.deb influxdb_install
1618
script:
17-
- travis_wait tox -e $TOX_ENV
19+
- export INFLUXDB_PYTHON_INFLUXD_PATH=$(pwd)/influxdb_install/opt/influxdb/versions/0.9.2/influxd
20+
- travis_wait 30 tox -e $TOX_ENV
1821
after_success:
1922
- if [ "$TOX_ENV" == "coverage" ] ; then coveralls; fi
2023
notifications:
2124
email: false
25+
26+
sudo: false
27+
28+
# Travis caching
29+
cache:
30+
directories:
31+
- $HOME/.cache/pip
32+
before_cache:
33+
- rm -f $HOME/.cache/pip/log/debug.log

README.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,10 @@ InfluxDB is an open-source distributed time series database, find more about Inf
3636

3737
.. _installation:
3838

39-
InfluxDB > v0.9 support
40-
=======================
41-
42-
The 1.0.0 version of this library now supports InfluxDB 0.9. Please note that InfluxDB 0.9 is still pre-release software. For stability, you should use the ``influxdb.influxdb08`` module in conjunction with InfluxDB 0.8.
43-
44-
4539
InfluxDB v0.8.X users
4640
=====================
4741

48-
Influxdb >=0.9.0 brings many breaking changes to the API. InfluxDB 0.8.X users may use the legacy client by using ``from influxdb.influxdb08 import InfluxDBClient`` instead.
42+
InfluxDB 0.9 was released and it is the new recommended version. However, InfluxDB 0.8.x users may still use the legacy client by using ``from influxdb.influxdb08 import InfluxDBClient`` instead.
4943

5044
Installation
5145
============
@@ -104,12 +98,12 @@ Here's a basic example (for more see the examples directory)::
10498

10599
>>> json_body = [
106100
{
107-
"name": "cpu_load_short",
101+
"measurement": "cpu_load_short",
108102
"tags": {
109103
"host": "server01",
110104
"region": "us-west"
111105
},
112-
"timestamp": "2009-11-10T23:00:00Z",
106+
"time": "2009-11-10T23:00:00Z",
113107
"fields": {
114108
"value": 0.64
115109
}

docs/source/resultset.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,39 @@ Query response object: ResultSet
77

88
Using the ``InfluxDBClient.query()`` function will return a ``ResultSet`` Object.
99

10-
A ResultSet behaves like a dict. Its keys are series and values are points. However, it is a little bit smarter than a regular dict. Its ``__getitem__`` method can be used to query the ResultSet in several ways.
10+
A ResultSet can be browsed in several ways. Its ``get_points`` method can be used to retrieve points generators that filter either by measurement, tags, or both.
1111

12-
Filtering by serie name
13-
-----------------------
12+
Getting all points
13+
------------------
1414

15-
Using ``rs['cpu']`` will return a generator for all the points that are in a serie named ``cpu``, no matter the tags.
15+
Using ``rs.get_points()`` will return a generator for all the points in the ResultSet.
16+
17+
18+
Filtering by measurement
19+
------------------------
20+
21+
Using ``rs.get_points('cpu')`` will return a generator for all the points that are in a serie with measurement name ``cpu``, no matter the tags.
1622
::
1723

1824
rs = cli.query("SELECT * from cpu")
19-
cpu_points = list(rs['cpu'])
25+
cpu_points = list(rs.get_points(measurement='cpu')])
2026

2127
Filtering by tags
2228
-----------------
2329

24-
Using ``rs[{'host_name': 'influxdb.com'}]`` will return a generator for all the points that are tagged with the specified tags, no matter the serie name.
30+
Using ``rs.get_points(tags={'host_name': 'influxdb.com'})`` will return a generator for all the points that are tagged with the specified tags, no matter the measurement name.
2531
::
2632

2733
rs = cli.query("SELECT * from cpu")
28-
cpu_influxdb_com_points = list(rs[{"host_name": "influxdb.com"}])
34+
cpu_influxdb_com_points = list(rs.get_points(tags={"host_name": "influxdb.com"}))
2935

30-
Filtering by serie name and tags
31-
--------------------------------
36+
Filtering by measurement and tags
37+
---------------------------------
3238

33-
Using a tuple with a serie name and a dict will return a generator for all the points that are in a serie with the given name AND whose tags match the given tags.
39+
Using measurement name and tags will return a generator for all the points that are in a serie with the specified measurement name AND whose tags match the given tags.
3440
::
3541

3642
rs = cli.query("SELECT * from cpu")
37-
points = list(rs[('cpu', {'host_name': 'influxdb.com'})])
43+
points = list(rs.get_points(measurement='cpu', tags={'host_name': 'influxdb.com'}))
3844

3945
See the :ref:`api-documentation` page for more information.

examples/tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ def main(host='localhost', port=8086):
1212
query = 'select value from cpu_load_short;'
1313
json_body = [
1414
{
15-
"name": "cpu_load_short",
15+
"measurement": "cpu_load_short",
1616
"tags": {
1717
"host": "server01",
1818
"region": "us-west"
1919
},
20-
"timestamp": "2009-11-10T23:00:00Z",
20+
"time": "2009-11-10T23:00:00Z",
2121
"fields": {
2222
"value": 0.64
2323
}

examples/tutorial_server_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def main(host='localhost', port=8086, nb_day=15):
2828
hostName = "server-%d" % random.randint(1, 5)
2929
# pointValues = [int(past_date.strftime('%s')), value, hostName]
3030
pointValues = {
31-
"timestamp": int(past_date.strftime('%s')),
32-
"name": metric,
31+
"time": int(past_date.strftime('%s')),
32+
"measurement": metric,
3333
'fields': {
3434
'value': value,
3535
},

examples/tutorial_sine_wave.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def main(host='localhost', port=8086):
2222
y = 10 + math.sin(math.radians(angle)) * 10
2323

2424
point = {
25-
"name": 'foobar',
26-
"timestamp": int(now.strftime('%s')) + angle,
25+
"measurement": 'foobar',
26+
"time": int(now.strftime('%s')) + angle,
2727
"fields": {
2828
"value": y
2929
}

influxdb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
]
1414

1515

16-
__version__ = '2.2.0'
16+
__version__ = '2.7.3'

influxdb/_dataframe_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ def _convert_dataframe_to_json(self, dataframe, measurement, tags=None):
137137
dataframe = dataframe.astype('object')
138138

139139
points = [
140-
{'name': measurement,
140+
{'measurement': measurement,
141141
'tags': tags if tags else {},
142142
'fields': rec,
143-
'timestamp': ts.isoformat()
143+
'time': ts.isoformat()
144144
}
145145
for ts, rec in zip(dataframe.index, dataframe.to_dict('record'))]
146146
return points

0 commit comments

Comments
 (0)