Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Adding multiple fields by using dict type doesn't work #898

Open
moweigel opened this issue Aug 26, 2021 · 0 comments
Open

Adding multiple fields by using dict type doesn't work #898

moweigel opened this issue Aug 26, 2021 · 0 comments

Comments

@moweigel
Copy link

  • InfluxDB version: latest
  • InfluxDB-python version: 5.3.1
  • Python version: 3.9
  • Operating system version:
    - Client - Windows
    - Server - Linux (Docker)

I'm not able to spot my mistake adding data to my InfluxDB by using the following scheme:

    from influxdb_client import InfluxDBClient
    import datetime
    from influxdb_client.client.write_api import ASYNCHRONOUS

    client_db = InfluxDBClient(url=f"http://{ip}:{port_db}", token=token, org=org)
    write_api = client_db.write_api(write_options=ASYNCHRONOUS)

    data = {
              "measurement": "title",
              "time": datetime.datetime.now().strftime("%m/%d/%y %H:%M:%S.%f"),
              "fields": db_dict    
           }    
          
    write_api.write(bucket=bucket, org=org, record=data)

where db_dict is a dictionary with multiple key:value entries. I don't receive any error but my DB remains without entries. It worked out fine before following this pattern - not this time. The titles of measurement and field of my inserted data are also displayed. I even tried varying with a time offset but didn't solve the problem. Any ideas whats the issue here? Thankful for every hint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant