From 7a78cc5dd4e19fa69f524a54a2cf56c6d5f346d7 Mon Sep 17 00:00:00 2001 From: Chi-Huan Nguyen Date: Mon, 25 Aug 2025 16:39:35 +0200 Subject: [PATCH] Add influxDbv3Session into database init --- pydase_service_base/database/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pydase_service_base/database/__init__.py b/pydase_service_base/database/__init__.py index 8a3b775..36ac921 100644 --- a/pydase_service_base/database/__init__.py +++ b/pydase_service_base/database/__init__.py @@ -3,6 +3,7 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: from .influxdb_session import InfluxDBSession # type: ignore from .influxdbv1_session import InfluxDBv1Session # type: ignore + from .influxdbv3_session import InfluxDBv3Session # type: ignore from .postgres_session import PostgresDatabaseSession # type: ignore else: @@ -34,7 +35,18 @@ else: "InfluxDBv1Session requires the 'influxdbv1' extra. " "Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base." ) + try: + import influxdb_client_3 # type: ignore # noqa + from .influxdbv3_session import InfluxDBv3Session # type: ignore + except ImportError: + + class InfluxDBv3Session: # type: ignore + def __init__(self) -> None: + raise OptionalDependencyError( + "InfluxDBv3Session requires the 'influxdbv3' extra. " + "Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base." + ) try: import sqlmodel # noqa @@ -49,4 +61,4 @@ else: ) -__all__ = ["InfluxDBSession", "InfluxDBv1Session", "PostgresDatabaseSession"] +__all__ = ["InfluxDBSession", "InfluxDBv1Session", "InfluxDBv3Session", "PostgresDatabaseSession"]