fix(datasource): Fix the bug of doris missing comments (#1308)

Co-authored-by: shenk-b <shenk-b@glodon.com>
This commit is contained in:
Kevin.Shin 2024-03-18 16:58:19 +08:00 committed by GitHub
parent 130ffb08c9
commit 84bedee306
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
from typing import Any, Iterable, List, Optional, Tuple
from typing import Any, Dict, Iterable, List, Optional, Tuple
from urllib.parse import quote
from urllib.parse import quote_plus as urlquote
@ -68,6 +68,26 @@ class DorisConnect(RDBMSDatabase):
"""Get user info."""
return []
def get_columns(self, table_name: str) -> List[Dict]:
"""Get columns.
Args:
table_name (str): str
Returns:
columns: List[Dict], which contains name: str, type: str, default_expression: str, is_in_primary_key: bool, comment: str
eg:[{'name': 'id', 'type': 'UInt64', 'default_expression': '', 'is_in_primary_key': True, 'comment': 'id'}, ...]
"""
fields = self.get_fields(table_name)
return [
{
"name": field[0],
"type": field[1],
"default": field[2],
"nullable": field[3],
"comment": field[4],
}
for field in fields
]
def get_fields(self, table_name) -> List[Tuple]:
"""Get column fields about specified table."""
cursor = self.get_session().execute(