mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-02 00:28:00 +00:00
fix(datasource): Fix the bug of doris missing comments (#1308)
Co-authored-by: shenk-b <shenk-b@glodon.com>
This commit is contained in:
parent
130ffb08c9
commit
84bedee306
@ -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
|
||||||
from urllib.parse import quote_plus as urlquote
|
from urllib.parse import quote_plus as urlquote
|
||||||
|
|
||||||
@ -68,6 +68,26 @@ class DorisConnect(RDBMSDatabase):
|
|||||||
"""Get user info."""
|
"""Get user info."""
|
||||||
return []
|
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]:
|
def get_fields(self, table_name) -> List[Tuple]:
|
||||||
"""Get column fields about specified table."""
|
"""Get column fields about specified table."""
|
||||||
cursor = self.get_session().execute(
|
cursor = self.get_session().execute(
|
||||||
|
Loading…
Reference in New Issue
Block a user