Skip to content

Commit 9a2caa8

Browse files
authored
Merge pull request influxdata#355 from gaker/fix-example-tutorial-server-data-error
Fix tutorial server data error.
2 parents 1ee50d5 + 11e8453 commit 9a2caa8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

examples/tutorial_server_data.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
from __future__ import print_function
13
import argparse
24

35
from influxdb import InfluxDBClient
@@ -38,7 +40,8 @@ def main(host='localhost', port=8086, nb_day=15):
3840
},
3941
}
4042
series.append(pointValues)
41-
print series
43+
44+
print(series)
4245

4346
client = InfluxDBClient(host, port, USER, PASSWORD, DBNAME)
4447

@@ -51,20 +54,20 @@ def main(host='localhost', port=8086, nb_day=15):
5154
client.create_database(DBNAME)
5255

5356
print("Create a retention policy")
54-
retention_policy = 'awesome_policy'
57+
retention_policy = 'server_data'
5558
client.create_retention_policy(retention_policy, '3d', 3, default=True)
5659

5760
print("Write points #: {0}".format(total_records))
5861
client.write_points(series, retention_policy=retention_policy)
5962

6063
time.sleep(2)
6164

62-
query = "SELECT MEAN(value) FROM %s WHERE time > now() - 10d GROUP BY time(500m)" % (metric)
63-
result = client.query(query, database=DBNAME, raw=False)
64-
print (result)
65+
query = "SELECT MEAN(value) FROM {} WHERE time > now() - 10d GROUP BY time(500m)".format(metric)
66+
result = client.query(query, database=DBNAME)
67+
print(result)
6568
print("Result: {0}".format(result))
6669

67-
print("Drop database: " + DBNAME)
70+
print("Drop database: {}".format(DBNAME))
6871
client.drop_database(DBNAME)
6972

7073

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy