fix: base_columnMetadata serialisation and connection handling#289
Open
earthshiner wants to merge 8 commits intoTeradata:mainfrom
Open
fix: base_columnMetadata serialisation and connection handling#289earthshiner wants to merge 8 commits intoTeradata:mainfrom
earthshiner wants to merge 8 commits intoTeradata:mainfrom
Conversation
earthshiner
commented
Apr 7, 2026
- Fixed return type annotation (-> dict) causing structured_content error
- Resolved SQLAlchemy vs TeradataConnection pattern mismatch
- Fixed return type annotation (-> dict) causing structured_content error - Resolved SQLAlchemy vs TeradataConnection pattern mismatch
…etadata tool - Removed unresolved conflict markers left by GitHub Desktop stash pop - Restored handle_base_columnMetadata and all private helper functions - Aligned imports with upstream (Callable from collections.abc) - Retained upstream handle_base_saveDDL - Removed tools now defined declaratively in YAML (tableList, databaseList, etc.)
Collaborator
|
Paul, |
Author
|
HI Dan,
Yes, I saw this, the restructure of the MCP server code base might have thrown my code a spanner. ☹
I will take a look to see what’s happening there.
My tool provides significant additional metadata over the existing (and simple YAML based tool) called base_columnDescription.
base_columnDescripton requires that the Teradata user has only SHOW permissions on the view, whereas my too, called base_columnMetadata which uses the HELP COLUMN syntax will require SHOW and SELECT permissions on any views being reported on. So, while the new tool surpasses what the existing simple tool can do, there is the question of permissions. There is, however and very frustratingly for me, no other way to get this fundamental metadata of a Teradata view, at least not without getting into using JDBC metadata or the like and therefore some Java involvement, and even then, I suspect you still need the SELECT permissions anyway. ☹
I am attaching some output from the tool rendered using Claude, it is showing the most commonly used subset of the data available using the HELP COLUMN method.
e.g. HELP COLUMN dt.* FROM (SELECT * FROM DBC.DatabasesV) AS dt WHERE 1=0;
This version of HELP COLUMN returns the metadata from all columns in a view in one go.
My tool can do one view at a time, or a list of views. If the list of views is large, the tool will execute the tool in a number of parallel streams to prevent MCP Server timeout and limits the number of columns returns to what you ask for.
Using the HELP COLUMN syntax is the only way to get certain column metadata, like datatypes, case specificity, nullability etc, it is not available in DBC anywhere.
New enhancements to HELP COLUMN are coming at the insistence of our new partner Immuta… the real solution (IMHO) would be for Engineering to populate the information in DBC.TVM but that is not happening any time soon.
From: dtehan-td ***@***.***>
Sent: Saturday, 11 April 2026 8:12 AM
To: Teradata/teradata-mcp-server ***@***.***>
Cc: Dancer, Paul ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [Teradata/teradata-mcp-server] fix: base_columnMetadata serialisation and connection handling (PR #289)
You don't often get email from ***@***.******@***.***>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
[CAUTION: External Email]
[https://avatars.githubusercontent.com/u/208072237?s=20&v=4]dtehan-td left a comment (Teradata/teradata-mcp-server#289)<#289 (comment)>
Paul,
The code did not pass the "uv run ruff check src/" and the "uv run mypy src/" checks. It might be good to understand the tool, I am looking to reduce the number of tools, so would love your thoughts on what tools this replaces, if any.
—
Reply to this email directly, view it on GitHub<#289 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMBBIVPOH2TXOVHZDE72ZXT4VFWSHAVCNFSM6AAAAACXO3POPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DEMRXGA4DEMJUGE>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
…n base_tools.py
…no SELECT privilege When the calling session lacks SELECT on a view (Teradata error 3523), the derived-table HELP COLUMN approach fails. This change catches that specific error and falls back to DBC.ColumnsVX — the same source used by the legacy base_columnDescription tool — preserving backward compatibility for restricted-privilege callers. - _help_column_view: detects error 3523, routes to _columnsVX_fallback - _columnsVX_fallback: new private function, returns normalised rows compatible with _standardise_helpcol_row output; marks each row with metadata_source='DBC.ColumnsVX' to signal reduced type fidelity - _process_one: generalised status skip (any truthy status) covers BROKEN_VIEW, PERMISSION_FALLBACK_ERROR, and future status values - keep-set: metadata_source always included even under fields filtering
…rmission fallback, fix docstrings Tables (T, O, Q): - Replace _help_column_table with _dbc_columns_table using DBC.ColumnsVX and DBC.IndicesVX — consistent security model, correct composite index grouping, no HELP COLUMN dependency for non-view objects Views (V): - Add DBC.ColumnsVX permission fallback (_columnsVX_fallback) when session lacks SELECT privilege (TD error 3523) — backward compatible with base_columnDescription behaviour; rows marked metadata_source='DBC.ColumnsVX' General: - Replace all magic numbers with named constants (TD_ERR_NO_SELECT_ACCESS, DEFAULT_PAYLOAD_KB, DEFAULT_EXECUTION_SECONDS, DEFAULT_MAX_WORKERS, MCP_TRANSPORT_TIMEOUT_SECONDS) - Generalise _process_one status skip to cover any truthy status value - Add metadata_source to always-included fields in keep-set - DBC.IndicesV → DBC.IndicesVX throughout - All docstrings and comments audited and corrected post-refactor: resolution paths, field counts, exclusion rationale, and path-agnostic builder function descriptions
UpperCase and Format must be quoted to be used as aliases
- Add CASE_SPECIFICITY_MAP constant: U=UPPERCASE, C=CASESPECIFIC, N=NOT CASESPECIFIC, NULL=not applicable - Add _build_case_string builder function — path-agnostic, handles both HELP COLUMN (views) and DBC.ColumnsVX (tables) UpperCase flag values. NCSNP treated as None — storage/padding variant, not a distinct case specificity value; raw NCSNP key remains available for callers that need the padding distinction - Add CaseSpecificityString computed field in _process_one alongside ColumnTypeString, IndexTypeString, and CharSetString - Add CaseSpecificityString to always-included keep-set fields - Update Returns docstring: three → four computed string fields
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.