diff --git a/influxdb_api.py b/influxdb_api.py index 0ca239b..aa76ee3 100644 --- a/influxdb_api.py +++ b/influxdb_api.py @@ -171,7 +171,11 @@ def query_pg_scada_info_non_realtime(name: str) -> None: # 2025/03/23 def get_new_client() -> InfluxDBClient: """每次调用返回一个新的 InfluxDBClient 实例。""" - return InfluxDBClient(url=url, token=token, org=org_name, timeout=600*1000) # 600 seconds + return InfluxDBClient(url=url, + token=token, + org=org_name, + enable_gzip=True, + timeout=600*1000) # 600 seconds # 2025/04/11, DingZQ def create_write_options() -> WriteOptions: @@ -3115,11 +3119,11 @@ if __name__ == "__main__": client = InfluxDBClient(url=url, token=token) # step1: 检查连接状态,初始化influxdb的buckets - # try: - # # delete_buckets(org_name) - # create_and_initialize_buckets(org_name) - # except Exception as e: - # print(f"连接失败: {e}") + try: + # delete_buckets(org_name) + create_and_initialize_buckets(org_name) + except Exception as e: + print(f"连接失败: {e}") # step2: 先查询pg数据库中scada_info的信息,然后存储SCADA数据到SCADA_data这个bucket里