Split public and private config/driver APIs (#6024)

This commit is contained in:
Jakub Kuczys
2025-01-27 00:25:53 +01:00
committed by GitHub
parent b13b1f8f16
commit f962aeb7b8
6 changed files with 46 additions and 30 deletions

View File

@@ -8,6 +8,8 @@ from .postgres import PostgresDriver
__all__ = [
"get_driver",
"get_driver_class",
"get_driver_class_include_old",
"ConfigCategory",
"IdentifierData",
"BaseDriver",
@@ -32,7 +34,7 @@ class BackendType(enum.Enum):
_DRIVER_CLASSES = {BackendType.JSON: JsonDriver, BackendType.POSTGRES: PostgresDriver}
def _get_driver_class_include_old(storage_type: Optional[BackendType] = None) -> Type[BaseDriver]:
def get_driver_class_include_old(storage_type: Optional[BackendType] = None) -> Type[BaseDriver]:
"""
ONLY for use in CLI for moving data away from a no longer supported backend
"""
@@ -115,7 +117,7 @@ def get_driver(
if not allow_old:
driver_cls: Type[BaseDriver] = get_driver_class(storage_type)
else:
driver_cls: Type[BaseDriver] = _get_driver_class_include_old(storage_type)
driver_cls: Type[BaseDriver] = get_driver_class_include_old(storage_type)
except ValueError:
if storage_type in (BackendType.MONGOV1, BackendType.MONGO):
raise RuntimeError(