diff --git a/main.py b/main.py index b7aef83..f85714d 100644 --- a/main.py +++ b/main.py @@ -2145,6 +2145,13 @@ async def fastapi_query_all_records_by_date(querydate: str) -> dict[str, list]: return { "nodes": results[0], "links": results[1] } +# 查询指定日期、类型、属性的所有记录 +# 返回 [{'time': '2024-01-01T00:00:00Z', 'ID': '1', 'value': 1.0}, {'time': '2024-01-01T00:00:00Z', 'ID': '2', 'value': 2.0}] +@app.get("/queryallrecordsbydateproperty/") +async def fastapi_query_all_records_by_date_property(querydate: str, querytype: str, property: str) -> list[dict[str, float|str]]: + return influxdb_api.query_all_record_by_date_property(query_date=querydate, type=querytype, property=property, client=influx_client) + + # def query_curve_by_ID_property_daterange(ID: str, type: str, property: str, start_date: str, end_date: str, bucket: str="realtime_data", client: InfluxDBClient=client) -> list: @app.get("/querynodecurvebyidpropertydaterange/") diff --git a/setup_influxdb.md b/setup_influxdb.md index a44a2cc..e4d6929 100644 --- a/setup_influxdb.md +++ b/setup_influxdb.md @@ -5,9 +5,10 @@ Setup instructions for WMH's work 2. import history_pattern_flow.csv run python online_Analysis.py - Should manullay change code + Should manually change code 3. run create_template.py -4. run influxdb_api.py +4. run influxdb_api.py + 在InfluxDB数据库中创建好我们需要的bucket create buckets \ No newline at end of file