Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/apps/datasource/models/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class TableSchemaResponse(BaseModel):


class ColumnSchema:
def __init__(self, attr1, attr2, attr3):
def __init__(self, attr1, attr2, attr3, *_extra_columns):
self.fieldName = attr1
self.fieldType = attr2
self.fieldComment = attr3 if attr3 is None or isinstance(attr3, str) else attr3.decode("utf-8")
Expand Down
32 changes: 32 additions & 0 deletions tests/test_hive_column_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Regression tests for Hive DESCRIBE result handling."""

import sys
import unittest
from pathlib import Path

BACKEND_DIR = Path(__file__).resolve().parents[1] / "backend"
sys.path.insert(0, str(BACKEND_DIR))


class HiveColumnSchemaTestCase(unittest.TestCase):
def test_ignores_driver_specific_describe_metadata(self) -> None:
from apps.datasource.models.datasource import ColumnSchema

row = (
"customer_id",
"bigint",
"customer identifier",
"PRIMARY_KEY",
"",
"",
)

field = ColumnSchema(*row)

self.assertEqual("customer_id", field.fieldName)
self.assertEqual("bigint", field.fieldType)
self.assertEqual("customer identifier", field.fieldComment)


if __name__ == "__main__":
unittest.main()