Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

How to set time using SeriesHelper? #259

Closed
@jeryini

Description

@jeryini

I tried to use SeriesHelper to set the time, but it keeps getting overridden with default current time when saving into DB. I have added it to the fields (don't know if this is correct, as the documentation does not specify anything about setting time):

class MeteorologicalDataHelper(SeriesHelper):
    # Meta class stores time series helper configuration.
    class Meta:
        # The client should be an instance of InfluxDBClient.
        client = myclient
        # The series name must be a string. Add dependent fields/tags in curly brackets.
        series_name = 'meteorological_data'
        # Defines all the fields in this time series.
        fields = ['time', 'air_temperature']
        # Defines all the tags for the series.
        tags = []
        # Defines the number of data points to store prior to writing on the wire.
        bulk_size = 100
        # autocommit must be set to True when using bulk_size
        autocommit = True

But it seems that this value is not used, for example I have executed the following:
MeteorologicalDataHelper(air_temperature=12, time=1434067467000000000)

And then checked in console of influx and the time was set to current time instead of the provided one:

> select * from meteorological_data
name: meteorological_data
-------------------------
time                air_temperature
2015-10-25T13:05:06.736935489Z  12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions