Add influxDbv3Session into database init

This commit is contained in:
Chi-Huan Nguyen
2025-08-25 16:39:35 +02:00
parent 7a62b36822
commit 7a78cc5dd4

View File

@@ -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"]