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.

make_lines does not provide timestamps in the resultant line protocol string  #788

Closed
@shantanoo-desai

Description

@shantanoo-desai
  • InfluxDB version: e.g. 1.7.7 (output of the influx version command)
    InfluxDB v.1.6.1

  • InfluxDB-python version: e.g. 5.2.2 (output of the python -c "from __future__ import print_function; import influxdb; print(influxdb.__version__)" command)
    5.2.3

  • Python version: e.g. 3.7.4 (output of the python --version command)
    3.6.1

  • Operating system version: e.g. Windows 10, Ubuntu 18.04, macOS 10.14.5
    Windows 10

Behavior

Assuming I wish to convert the following valid JSON structure:

measurement = {
    'tags': {
          'source': 'gps'
     }, 
     'points': [
          {
           'measurement': 'location', 
           'fields': {
                  'lat': 53.11203666666667
           }
      }
     ],
     'time': '1582562852'
}

I use the following code:

from influxdb import line_protocol
measurement = {
    'tags': {
          'source': 'gps'
     }, 
     'points': [
          {
           'measurement': 'location', 
           'fields': {
                  'lat': 53.11203666666667
           }
      }
     ],
     'time': '1582562852'
}

print(line_protocol.make_lines(measurement, precision='s'))

Only provides the following output without the timestamp:

'location,source=gps lat=53.11203666666667\n'

There is timestamp that is added to the line protocol result.

Irrespective if time is a string or not the resultant line protocol does not add timestamps to it.

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