Skip to content

fix: base_columnMetadata serialisation and connection handling#289

Open
earthshiner wants to merge 8 commits intoTeradata:mainfrom
earthshiner:td_columnMetadata
Open

fix: base_columnMetadata serialisation and connection handling#289
earthshiner wants to merge 8 commits intoTeradata:mainfrom
earthshiner:td_columnMetadata

Conversation

@earthshiner
Copy link
Copy Markdown

  • 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.)
@dtehan-td
Copy link
Copy Markdown
Collaborator

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.

@earthshiner
Copy link
Copy Markdown
Author

earthshiner commented Apr 12, 2026 via email

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants