This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clickhouse/fix/lexical parsing (#240)
* fix(clickhouse): datetime lexical parsing * fix(clickhouse): aggfunctions lexical parsing
- Loading branch information
Showing
7 changed files
with
136 additions
and
23 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
from typing import List | ||
|
||
from odd_collector_sdk.domain.adapter import AbstractAdapter | ||
from odd_collector_sdk.domain.adapter import BaseAdapter | ||
from odd_models.models import DataEntity, DataEntityList | ||
from oddrn_generator import ClickHouseGenerator | ||
from oddrn_generator import ClickHouseGenerator, Generator | ||
|
||
from ...domain.plugin import ClickhousePlugin | ||
from .mappers.tables import map_table | ||
from .repository import ClickHouseRepository | ||
|
||
|
||
class Adapter(AbstractAdapter): | ||
class Adapter(BaseAdapter): | ||
generator: ClickHouseGenerator | ||
config: ClickhousePlugin | ||
|
||
def __init__(self, config: ClickhousePlugin) -> None: | ||
self.__db = config.database | ||
self.clickhouse_repository = ClickHouseRepository(config) | ||
self.__oddrn_generator = ClickHouseGenerator( | ||
host_settings=f"{config.host}", databases=config.database | ||
) | ||
super().__init__(config) | ||
self.db = config.database | ||
self.repository = ClickHouseRepository(config) | ||
|
||
def get_data_source_oddrn(self) -> str: | ||
return self.__oddrn_generator.get_data_source_oddrn() | ||
def create_generator(self) -> Generator: | ||
return ClickHouseGenerator( | ||
host_settings=f"{self.config.host}", databases=self.config.database | ||
) | ||
|
||
def get_data_entities(self) -> List[DataEntity]: | ||
records = self.clickhouse_repository.get_records() | ||
records = self.repository.get_records() | ||
return map_table( | ||
self.__oddrn_generator, | ||
self.generator, | ||
records.tables, | ||
records.columns, | ||
records.integration_engines, | ||
self.__db, | ||
self.db, | ||
) | ||
|
||
def get_data_entity_list(self) -> DataEntityList: | ||
return DataEntityList( | ||
data_source_oddrn=self.get_data_source_oddrn(), | ||
items=(self.get_data_entities()), | ||
items=self.get_data_entities(), | ||
) |
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