diff --git a/influxdb_api.py b/influxdb_api.py index 2d2b9e3..cce8e78 100644 --- a/influxdb_api.py +++ b/influxdb_api.py @@ -1355,28 +1355,6 @@ def query_measurements(bucket: str, client: InfluxDBClient=client) -> list[str]: return measurements -def query_tags(bucket: str, measurement: str, client: InfluxDBClient=client) -> list[str]: - query_api = client.query_api() - - # 定义 Flux 查询 - query = f''' - from(bucket: "{bucket}") - |> range(start: -1y) # 时间范围(可根据需要调整) - |> filter(fn: (r) => r._measurement == "{measurement}") - |> tagKeys() # 直接获取所有 Tag 键名 - ''' - - # 执行查询 - result = query_api.query(query) - - # 提取 Tag 列表 - tag_keys = [] - #for table in result: - # for record in table.records: - # tag_keys.append(record.get_value()) - # - return tag_keys - # 示例调用 if __name__ == "__main__": url = influxdb_info.url diff --git a/main.py b/main.py index 11cb51e..7138483 100644 --- a/main.py +++ b/main.py @@ -2138,9 +2138,6 @@ async def fastapi_query_influxdb_buckets(): async def fastapi_query_influxdb_bucket_measurements(bucket: str): return influxdb_api.query_measurements(bucket=bucket) -@app.get("/queryinfluxdbbuckettags/") -async def fastapi_query_influxdb_bucket_tags(bucket: str, measurement: str): - return influxdb_api.query_tags(bucket=bucket, measurement=measurement) # DingZQ, 2024-12-31, generate openapi.json