Skip to content

Reject a non-list columns value in Schema.from_tables - #523

Merged
arrry-hydraDB merged 1 commit into
hydra-db:mainfrom
jaywyawhare:fix/from-tables-nonlist-columns
Nov 26, 2026
Merged

arrry-hydraDB merged 1 commit into
hydra-db:mainfrom
jaywyawhare:fix/from-tables-nonlist-columns

Conversation

@jaywyawhare

@jaywyawhare jaywyawhare commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Schema.from_tables iterated a table's columns without checking its type. A truthy non-list value raised a bare TypeError ('int' object is not iterable), and a string was iterated character by character and reported as each column needs a name. Both SDKs now reject a non-list columns with a coded ValidationError before the loop.

Schema.from_tables([{"name": "orders", "columns": 5}])
# ValidationError[invalid_argument], field 'columns':
# tables[0].columns must be a list of column mappings, got number

The type word comes from the shared type_name/typeName, so 5 and 1.5 report number, True reports boolean, and "abc" reports string, identical in both SDKs and matching the existing tables must be a list of table mappings, got ... message. A missing, None, or empty columns is unchanged.

Linked issue

Closes #307

Checklist

  • Fixed in both SDKs (src/selfgraph/_tables.py, typescript/src/tables.ts), invalid_argument with field="columns", identical message text.
  • Regression tests in both SDKs (tests/test_schema_regressions.py, typescript/test/schemaRegressions.test.ts) that fail on main and pass with the fix.
  • Extended the tables_reference_errors conformance pair with the non-list cases, so the two SDKs stay byte-identical.
  • Lint, typecheck, precheck, and the Kuzu conformance run clean.

Breaking changes

None. Valid input is unchanged; a non-list columns that used to crash with TypeError now fails with a coded error.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

Copy link
Copy Markdown

Start the description with ## Summary, followed by one collapsed <details> block that holds everything else, as in .github/pull_request_template.md.

The AI assistance section is missing from the PR description. Restore it from the PR template and disclose whether AI tools were used.

@github-actions

Copy link
Copy Markdown

This is PR 2 of 10 you may keep open at a time.

@github-actions

Copy link
Copy Markdown

Start the description with ## Summary, followed by one collapsed <details> block that holds everything else, as in .github/pull_request_template.md.

The AI assistance section is missing from the PR description. Restore it from the PR template and disclose whether AI tools were used.

@arrry-hydraDB
arrry-hydraDB merged commit eaae60d into hydra-db:main Nov 26, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema.from_tables raises TypeError on non-list columns

2 participants