influxdbinfluxdb-pythoninfluxdb-2

Influxdb client query returns empty list even though there is a data


query_api = self.client.query_api()
query = f"""from(bucket: "{self.bucket_name}")
    |> range(start: -60d)
    |> filter(fn: (r) => r._tag == "{tag}" )
    |> yield(name: "name")"""
result = query_api.query(org = self.organization_name, query = query)

I'm using the query above in python with influxdb_client but it gives me empty list. In InfluxDb UI there are a lot of data. What is missing in my code here?


Solution

  • I was checking tag r._tag, I fixed it with using r.tag