-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added query compiler to all connector classes
- Loading branch information
Showing
9 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
lib/dl_core/dl_core/data_processing/query_compiler_registry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from typing import Type | ||
|
||
from dl_constants.enums import SourceBackendType | ||
from dl_core.connectors.base.query_compiler import QueryCompiler | ||
|
||
|
||
_QUERY_COMPILER_CLS_BY_BACKEND: dict[SourceBackendType, Type[QueryCompiler]] = {} | ||
|
||
|
||
def register_sa_query_compiler_cls(backend_type: SourceBackendType, sa_query_compiler_cls: Type[QueryCompiler]) -> None: | ||
if (registered_compiler_cls := _QUERY_COMPILER_CLS_BY_BACKEND.get(backend_type)) is not None: | ||
assert registered_compiler_cls == sa_query_compiler_cls | ||
else: | ||
_QUERY_COMPILER_CLS_BY_BACKEND[backend_type] = sa_query_compiler_cls | ||
|
||
|
||
def get_sa_query_compiler_cls(backend_type: SourceBackendType) -> Type[QueryCompiler]: | ||
return _QUERY_COMPILER_CLS_BY_BACKEND[backend_type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters