Skip to content

fix: pool settings propagation and qlty_rowsWithMissingValues tool fixes - #479

Merged
dtehan-td merged 6 commits into
Teradata:mainfrom
dtehan-td:main
Oct 25, 2026
Merged

dtehan-td merged 6 commits into
Teradata:mainfrom
dtehan-td:main

Conversation

@dtehan-td

Copy link
Copy Markdown
Collaborator

Summary

Details

Issue #449 — TD_POOL_SIZE / TD_MAX_OVERFLOW / TD_POOL_TIMEOUT ignored

parse_args_to_settings() in server.py merged CLI args with env settings but silently dropped several environment-only fields when constructing the final Settings object. Affected fields:

Fix: pass all missing fields through from settings_from_env().

A regression test was added in tests/phase0/test_pool_settings.py covering custom values, defaults, and the other previously-dropped env-only settings.

qlty_rowsWithMissingValues tool

The tool SQL used TD_getRowsWithMissingValues, a Teradata analytic function that is not available on all systems. Replaced with portable standard SQL:

select top 50 * from {table_ref} where {column_name} is null

TOP 50 prevents oversized SSE responses when the tool is called against wide catalog tables like DBC.TablesV (which has a large RequestText DDL column). Without the limit, 1000 capped rows of DDL text can exhaust the SSE stream buffer.

Test plan

  • python tests/phase0/test_pool_settings.py — all 3 assertions pass
  • Integration test suite passes for qlty_rowsWithMissingValues (both rows_missing_values and tables_missing_comment)
  • Verify TD_POOL_SIZE=37 TD_MAX_OVERFLOW=4 TD_POOL_TIMEOUT=91 uv run teradata-mcp-server reflects custom pool settings at startup

…Teradata#474)

The SQLAlchemy pool is lazy and opens no connections until the first tool
call. In environments with stateful firewalls or NAT (e.g. GCP VMs), the
initial TCP connection to Teradata stalls while the network path is
established, causing the first pipeline request to hang indefinitely with
no LogonOff entry recorded.

Eagerly connect with SELECT 1 in the lifespan startup block so the
cold-start hang surfaces at server startup rather than on the first client
request, and ensures at least one pooled connection is ready before the
server begins serving.
…_to_settings()

Fixes issue Teradata#449: TD_POOL_SIZE, TD_MAX_OVERFLOW, and TD_POOL_TIMEOUT
environment variables were read in settings_from_env() but then lost when
parse_args_to_settings() created a new Settings instance without copying
these fields.

Also propagates other environment-only fields that were previously dropped:
- ping_interval
- auth_rate_limit_attempts
- auth_rate_limit_window
- registry_refresh_interval

These fields now survive the transition from settings_from_env() to the
final Settings object, ensuring that environment-based configuration is
fully respected.

Adds regression test in tests/phase0/test_pool_settings.py to prevent
recurrence and verifies both custom and default values work correctly.
The TD_getRowsWithMissingValues function either doesn't exist or is not available
in the Teradata installation, causing the qlty_rowsWithMissingValues tool to fail
with "SSE stream ended without a response" errors.

Replaced with a simpler, standard SQL approach using WHERE IS NULL to retrieve
rows with missing values in the specified column. This approach:
- Works on all Teradata systems without special function availability
- Is simpler and more readable
- Accomplishes the same goal more efficiently

Fixes the qlty_rowsWithMissingValues test failures.
The tables_missing_comment test was using 'Tables' which either doesn't exist
or doesn't have the CommentString column. Changed to 'TablesV' to match the
Teradata system view naming convention and ensure the column exists.

This makes the test case consistent with DBC system views that use the 'V'
suffix (e.g., TablesV, DatabasesV, etc.).
…es test

DBC.TablesV returns 1000 rows (hit the row cap), each containing a large
RequestText column with DDL text. The response is too large for the SSE
stream, causing 'SSE stream ended without a response'.

DBC.ColumnsV has the same CommentString column for column-level comments
but without large DDL text fields, keeping the response to a manageable
size while still testing the same tool functionality.
…E responses

SELECT * on wide catalog tables (e.g. TablesV with its RequestText DDL column)
can return 1000 capped rows totalling many MB, causing the SSE stream to close
before the response is transmitted.

Adding TOP 50 keeps the response to a manageable size while still returning
enough rows for the tool to be useful. Also restores the TablesV test case
which is a realistic wide-table scenario.
@dtehan-td
dtehan-td merged commit 8470ab4 into Teradata:main Oct 25, 2026
4 checks passed
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.

TD_POOL_SIZE, TD_MAX_OVERFLOW, and TD_POOL_TIMEOUT environment variables are ignored

1 participant