Skip to content

fix: show falsy sample values instead of NULL in introspect_schema#27

Open
Osamaali313 wants to merge 1 commit into
agno-agi:mainfrom
Osamaali313:fix/introspect-falsy-sample-values
Open

fix: show falsy sample values instead of NULL in introspect_schema#27
Osamaali313 wants to merge 1 commit into
agno-agi:mainfrom
Osamaali313:fix/introspect-falsy-sample-values

Conversation

@Osamaali313

Copy link
Copy Markdown

Problem

The sample-data renderer in introspect_schema formatted each cell with:

vals = [str(v)[:30] if v else "NULL" for v in row]

if v is truthiness, so every falsy column value — 0, 0.0, False, empty string, Decimal('0') — was displayed as NULL. The agent reading the schema sample then sees missing data where real values exist.

Reproduction

Running the real tool against a SQLite table with a row of (0, '', 0, 0.0):

Before

| qty | name | flag | price |
| --- | --- | --- | --- |
| NULL | NULL | NULL | NULL |
| 5 | hello | 1 | 9.5 |

After

| qty | name | flag | price |
| --- | --- | --- | --- |
| 0 |  | 0 | 0.0 |
| 5 | hello | 1 | 9.5 |

Fix

Treat only None as NULL; render every other value (including falsy ones) with str(v)[:30]:

vals = ["NULL" if v is None else str(v)[:30] for v in row]

The sample-row renderer used `str(v)[:30] if v else "NULL"`, so any falsy column value (0, 0.0, False, empty string, Decimal('0')) was displayed as NULL. A row of (0, '', 0, 0.0) rendered as | NULL | NULL | NULL | NULL |, misrepresenting real data to the agent reading the schema.

Only None is NULL; render every other value (including falsy ones) via str(v)[:30].
Copilot AI review requested due to automatic review settings June 24, 2026 21:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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