Skip to content

tds: return None instead of "NULL" string for SQL NULL values#2185

Open
n3rada wants to merge 1 commit into
fortra:masterfrom
n3rada:tds-null-to-none
Open

tds: return None instead of "NULL" string for SQL NULL values#2185
n3rada wants to merge 1 commit into
fortra:masterfrom
n3rada:tds-null-to-none

Conversation

@n3rada
Copy link
Copy Markdown
Contributor

@n3rada n3rada commented May 11, 2026

parseRow() and TDS_SSVARIANT._parseValue() returned the string "NULL" for SQL NULL values. This is semantically wrong: downstream code cannot distinguish a genuine NULL from a column that literally contains the text "NULL", and standard Python idioms like if value is None or value or default do not work.

Replace every value = "NULL" / return "NULL" with None. Update processColMeta() and printRows() to format None as the string "NULL" for display output, preserving the existing table rendering.

parseRow() and TDS_SSVARIANT._parseValue() returned the string "NULL"
for SQL NULL values.  This is semantically wrong: downstream code
cannot distinguish a genuine NULL from a column that literally contains
the text "NULL", and standard Python idioms like `if value is None` or
`value or default` do not work.

Replace every `value = "NULL"` / `return "NULL"` with `None`.
Update processColMeta() and printRows() to format None as the string
"NULL" for display output, preserving the existing table rendering.
@n3rada
Copy link
Copy Markdown
Contributor Author

n3rada commented May 20, 2026

What is your opinion about this one @gabrielg5

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.

1 participant