On Thursday, December 1, 2016 at 2:13:39 PM UTC-8, Ross McDonald wrote:
> There is no precision specified on the writes, so they are defaulting to 
> nanosecond. The retention policy is also being set here for 3 days so the 
> writes are getting dropped as they're being written, since the timestamps are 
> very far in the past (in nanosecond land).
> 
> To fix it, you'll want to set the timestamp precision to "s" (seconds) here:
> 
> ```
> client.write_points(series, retention_policy=retention_policy, 
> time_precision="s")
> ```
> 
> 
> 
> 
> On Thu, Dec 1, 2016 at 2:38 PM,  <vika...@gmail.com> wrote:
> Hi,
> 
> 
> 
> I am new to influxdb.
> 
> 
> 
> I have influxdb server version 1.0.1 running.
> 
> 
> 
> I am using influxdb-python (influxdb-3.0.0) and trying the tutorial
> 
> 
> 
> https://github.com/influxdata/influxdb-python/blob/master/examples/tutorial_server_data.py
> 
> 
> 
> I get
> 
> 
> 
> $ python tutorial_server_data.py
> 
> Create database: tutorial
> 
> Create a retention policy
> 
> Write points #: 4320
> 
> ResultSet({})
> 
> Result: ResultSet({})
> 
> 
> 
> 
> 
> i.e. I cannot read back any of the inserted values. I even relaxed the query 
> to show all.
> 
> 
> 
> Also when I do
> 
> 
> 
> query = 'SHOW DATABASES'
> 
> result = myclient.query(query)
> 
> result
> 
> 
> 
> I can see 'tutorial' in the output. So I am able to talk to my influxdb server
> 
> 
> 
> But
> 
> query = 'SHOW MEASUREMENTS'
> 
> result = myclient.query(query)
> 
> result
> 
> 
> 
> give nothing.
> 
> 
> 
> I assume I am missing something trivial.
> 
> 
> 
> Can someone help?
> 
> 
> 
> Thanks,
> 
> Vikas
> 
> 
> 
> --
> 
> Remember to include the version number!
> 
> ---
> 
> You received this message because you are subscribed to the Google Groups 
> "InfluxData" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to influxdb+u...@googlegroups.com.
> 
> To post to this group, send email to infl...@googlegroups.com.
> 
> Visit this group at https://groups.google.com/group/influxdb.
> 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/influxdb/ac0d5500-8707-41d9-8ed8-8fca8c9e446b%40googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.

Thanks.
I have it.


    print("Create a retention policy")
    retention_policy = 'server_data'
    client.create_retention_policy(retention_policy, '3d', 3, default=True)

    print("Write points #: {0}".format(total_records))
    client.write_points(series, time_precision='s', 
retention_policy=retention_policy)

    time.sleep(1)

    #query = "SELECT MEAN(value) FROM {} WHERE time > now() - 10d GROUP BY 
time(500m)".format(metric)
    query = "SELECT MEAN(value) FROM {}".format(metric)
    result = client.query(query, database=DBNAME)
    print(result)
    print("Result: {0}".format(result))

The result is still empty.

-- 
Remember to include the version number!
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to influxdb+unsubscr...@googlegroups.com.
To post to this group, send email to influxdb@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/f197875b-2820-490b-90b2-51b3d2e16a9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to