-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from hkad98/NAS-3749
NAS-3749 fix table_prefix ignored Reviewed-by: Jan Soubusta https://github.com/jaceksan
- Loading branch information
Showing
6 changed files
with
168 additions
and
81 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
62 changes: 21 additions & 41 deletions
62
gooddata-sdk/gooddata_sdk/catalog/data_source/entity_model/content_objects/table.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 |
---|---|---|
@@ -1,52 +1,32 @@ | ||
# (C) 2022 GoodData Corporation | ||
from __future__ import annotations | ||
|
||
from typing import Any, List | ||
from typing import List, Optional | ||
|
||
from gooddata_sdk.catalog.entity import CatalogEntity | ||
import attr | ||
|
||
from gooddata_sdk.catalog.base import Base | ||
|
||
class CatalogDataSourceTable(CatalogEntity): | ||
@property | ||
def table_type(self) -> str: | ||
return self._e["type"] | ||
|
||
@property | ||
def path(self) -> List[str]: | ||
return self._e["path"] | ||
@attr.s(auto_attribs=True, kw_only=True) | ||
class CatalogDataSourceTable(Base): | ||
id: str | ||
type: str | ||
attributes: CatalogDataSourceTableAttributes | ||
|
||
@property | ||
def columns(self) -> List[CatalogDataSourceTableColumn]: | ||
return [CatalogDataSourceTableColumn(c) for c in self._e["columns"]] | ||
|
||
@property | ||
def username(self) -> str: | ||
return self._e["username"] | ||
@attr.s(auto_attribs=True, kw_only=True) | ||
class CatalogDataSourceTableAttributes(Base): | ||
columns: List[CatalogDataSourceTableColumn] | ||
name_prefix: Optional[str] = None | ||
path: Optional[List[str]] = None | ||
type: Optional[str] = None | ||
|
||
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}(id={self.id}, path={str(self.path)})" | ||
|
||
|
||
class CatalogDataSourceTableColumn: | ||
def __init__(self, column: dict[str, Any]) -> None: | ||
self._c = column | ||
|
||
@property | ||
def name(self) -> str: | ||
return self._c["name"] | ||
|
||
@property | ||
def data_type(self) -> str: | ||
return self._c["dataType"] | ||
|
||
@property | ||
def referenced_table_id(self) -> str: | ||
return self._c["referencedTableId"] | ||
|
||
@property | ||
def referenced_table_column(self) -> str: | ||
return self._c["referencedTableColumn"] | ||
|
||
@property | ||
def primary_key(self) -> str: | ||
return self._c["primaryKey"] | ||
@attr.s(auto_attribs=True, kw_only=True) | ||
class CatalogDataSourceTableColumn(Base): | ||
name: str | ||
data_type: str | ||
is_primary_key: Optional[bool] = None | ||
referenced_table_column: Optional[str] = None | ||
referenced_table_id: Optional[str] = None |
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
Oops, something went wrong.