From 3fbde84571b4043210cb7f4b63d8dfe665b4b420 Mon Sep 17 00:00:00 2001 From: Ovsyannikov Dmitrii Date: Wed, 21 Feb 2024 14:16:49 +0100 Subject: [PATCH] feat: add EXPERIMENTAL_BITRIX_ENABLE_JOIN_TYPES flag (#328) * feat: add EXPERIMENTAL_BITRIX_ENABLE_JOIN_TYPES flag * fix: mypy --- .../core/data_source.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/dl_connector_bitrix_gds/dl_connector_bitrix_gds/core/data_source.py b/lib/dl_connector_bitrix_gds/dl_connector_bitrix_gds/core/data_source.py index b8b02c330..964d175d2 100644 --- a/lib/dl_connector_bitrix_gds/dl_connector_bitrix_gds/core/data_source.py +++ b/lib/dl_connector_bitrix_gds/dl_connector_bitrix_gds/core/data_source.py @@ -1,5 +1,6 @@ from __future__ import annotations +import os from typing import ( ClassVar, Optional, @@ -21,8 +22,23 @@ ) +def _get_supported_join_types() -> frozenset[JoinType]: + flag = os.environ.get("EXPERIMENTAL_BITRIX_ENABLE_JOIN_TYPES", "false") + if flag.lower() == "true": + return frozenset( + { + JoinType.inner, + JoinType.left, + JoinType.full, + JoinType.right, + } + ) + + return frozenset() + + class BitrixGDSDataSource(PseudoSQLDataSource): - supported_join_types: ClassVar[frozenset[JoinType]] = frozenset() + supported_join_types: ClassVar[frozenset[JoinType]] = _get_supported_join_types() conn_type = CONNECTION_TYPE_BITRIX24 @property