Commit e4032ea5 authored by MacFarland's avatar MacFarland
Browse files

using the mixin workaround

parent 17d1aa80
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -10,9 +10,6 @@ from concurrent.futures import ThreadPoolExecutor
from common.env import mock_env_vars
from common.database import Database
from common.logz import create_logger
from common.mixins.postgres import PostgresMixin
from common.mixins.mssql import MSSQLMixin
from common.mixins.influx import InfluxMixin


class MultiDatabase:
@@ -36,13 +33,16 @@ class MultiDatabase:
    @staticmethod
    def _get_mixin_for_type(
        db_type: str,
    ) -> Optional[Type[Union[PostgresMixin, MSSQLMixin, InfluxMixin]]]:
    ) -> Optional[Type[Union['PostgresMixin', 'MSSQLMixin', 'InfluxMixin']]]:
        db_type = db_type.lower()
        if db_type.startswith("postgres") or db_type.startswith("pg"):
            from common.mixins.postgres import PostgresMixin
            return PostgresMixin
        if db_type.startswith("mssql"):
            from common.mixins.mssql import MSSQLMixin
            return MSSQLMixin
        if db_type.startswith("influx"):
            from common.mixins.influx import InfluxMixin
            return InfluxMixin
        # add more database Mixins here as they become available
        return None