This is an automated email from the ASF dual-hosted git repository.

FreeOnePlus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-mcp-server.git


The following commit(s) were added to refs/heads/master by this push:
     new 163515c  fix: return Doris column comments in table schema (#156)
163515c is described below

commit 163515cc8087e39719fe4cfc22d884c10d9810e4
Author: Yijia Su <[email protected]>
AuthorDate: Thu Jul 30 18:43:44 2026 +0800

    fix: return Doris column comments in table schema (#156)
---
 doris_mcp_server/utils/schema_extractor.py         |  7 +++-
 test/integration/test_real_doris_transports.py     | 16 +++++++-
 ...schema_extractor_doris_oauth_metadata_errors.py | 48 ++++++++++++++++++++++
 3 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/doris_mcp_server/utils/schema_extractor.py 
b/doris_mcp_server/utils/schema_extractor.py
index b43f735..07e4dda 100644
--- a/doris_mcp_server/utils/schema_extractor.py
+++ b/doris_mcp_server/utils/schema_extractor.py
@@ -1667,9 +1667,12 @@ class MetadataExtractor:
 
             if effective_catalog and effective_catalog != "internal":
                 safe_catalog = quote_identifier(effective_catalog, "catalog 
name")
-                query = f"DESCRIBE {safe_catalog}.{safe_db}.{safe_table}"
+                query = (
+                    "SHOW FULL COLUMNS FROM "
+                    f"{safe_catalog}.{safe_db}.{safe_table}"
+                )
             else:
-                query = f"DESCRIBE {safe_db}.{safe_table}"
+                query = f"SHOW FULL COLUMNS FROM {safe_db}.{safe_table}"
 
             # Execute async query
             result = await self._execute_query_async(query, db_name)
diff --git a/test/integration/test_real_doris_transports.py 
b/test/integration/test_real_doris_transports.py
index 2a61678..cc6ea74 100644
--- a/test/integration/test_real_doris_transports.py
+++ b/test/integration/test_real_doris_transports.py
@@ -148,7 +148,7 @@ def doris_sandbox() -> DorisSandbox:
                 f"""
                 CREATE TABLE {qualified_table} (
                     id BIGINT,
-                    marker VARCHAR(64)
+                    marker VARCHAR(64) COMMENT 'Integration marker'
                 )
                 DUPLICATE KEY(id)
                 DISTRIBUTED BY HASH(id) BUCKETS 1
@@ -814,6 +814,20 @@ async def test_real_doris_tool_regression_paths(
         assert basic_info_result.structured_content["row_count"] == 1
         assert basic_info_result.structured_content["column_count"] == 2
 
+        schema_result = await client.call_tool(
+            "get_table_schema",
+            {
+                "table_name": doris_sandbox.table,
+                "db_name": doris_sandbox.settings.database,
+            },
+        )
+        assert schema_result.is_error is False
+        assert isinstance(schema_result.structured_content, dict)
+        schema_columns = schema_result.structured_content["result"]
+        assert next(
+            column for column in schema_columns if column["column_name"] == 
"marker"
+        )["comment"] == "Integration marker"
+
         column_analysis_result = await client.call_tool(
             "analyze_columns",
             {
diff --git a/test/utils/test_schema_extractor_doris_oauth_metadata_errors.py 
b/test/utils/test_schema_extractor_doris_oauth_metadata_errors.py
index 1aa3842..82e25fa 100644
--- a/test/utils/test_schema_extractor_doris_oauth_metadata_errors.py
+++ b/test/utils/test_schema_extractor_doris_oauth_metadata_errors.py
@@ -79,6 +79,54 @@ async def _call_tool(method_name, args, connection_manager):
         reset_auth_context(token)
 
 
[email protected](
+    ("catalog_name", "expected_query"),
+    [
+        (None, "SHOW FULL COLUMNS FROM `db1`.`tbl1`"),
+        ("internal", "SHOW FULL COLUMNS FROM `db1`.`tbl1`"),
+        ("hive", "SHOW FULL COLUMNS FROM `hive`.`db1`.`tbl1`"),
+    ],
+)
[email protected]
+async def test_table_schema_uses_full_columns_and_preserves_comments(
+    catalog_name,
+    expected_query,
+):
+    connection_manager = FakeConnectionManager(
+        rows=[
+            {
+                "Field": "customer_id",
+                "Type": "bigint",
+                "Null": "NO",
+                "Key": "YES",
+                "Default": None,
+                "Extra": "",
+                "Comment": "Customer identifier",
+            }
+        ]
+    )
+    extractor = MetadataExtractor(db_name="db1", 
connection_manager=connection_manager)
+
+    schema = await extractor.get_table_schema_async(
+        "tbl1",
+        "db1",
+        catalog_name,
+    )
+
+    assert connection_manager.calls[0][1] == expected_query
+    assert schema == [
+        {
+            "column_name": "customer_id",
+            "data_type": "bigint",
+            "is_nullable": False,
+            "default_value": None,
+            "comment": "Customer identifier",
+            "key": "YES",
+            "extra": "",
+        }
+    ]
+
+
 @pytest.mark.parametrize(("tool_name", "method_name", "args"), 
METADATA_TOOL_CASES)
 @pytest.mark.parametrize(
     ("error", "error_code", "status_code"),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to