Skip to content

Fix TypeTracker inferring wrong type for CSV columns containing only empty strings#807

Open
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-value-tracker-empty-string-type
Open

Fix TypeTracker inferring wrong type for CSV columns containing only empty strings#807
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-value-tracker-empty-string-type

Conversation

@ikatyal2110

@ikatyal2110 ikatyal2110 commented Jul 20, 2026

Copy link
Copy Markdown

ValueTracker.evaluate() used if not value to skip None, but this also skipped empty strings (""), causing a CSV column whose every row is blank to be typed as INTEGER (the initial default) rather than TEXT. The fix replaces the falsy check with an explicit if value is None so only actual NULL values are skipped and empty strings are passed through the type tests, which correctly eliminate integer and float as candidates.


Generated by Claude Code


📚 Documentation preview 📚: https://sqlite-utils--807.org.readthedocs.build/en/807/

`ValueTracker.evaluate()` used `if not value` to skip NULL values, but
this also skipped empty strings (`""`), `0`, and other falsy values.
A CSV column containing only empty strings was incorrectly inferred as
INTEGER (the initial default) instead of TEXT.

Replace the falsy check with an explicit `if value is None` so that only
NULL is skipped and all other values — including `""` — are evaluated
against the type tests.
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