Repository navigation
feat(loader)!: declared columns missing from the data follow on_schema_change - #364
Merged
Merged
Conversation
Deploying sqlload with
|
| Latest commit: |
cc2f4b2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c743dbd6.sqlload.pages.dev |
| Branch Preview URL: | https://feat-missing-declared-column.sqlload.pages.dev |
…a_change A column declared in `columns` that the data lacks no longer fails plan unconditionally (Parquet files) or loads as NULL silently (Python tables). on_schema_change decides: append_new_columns and ignore load it as NULL at its declared type with a warning, and fail refuses the table. A declared column is never dropped. - Files sources: a pin no sampled file holds (Parquet footers as well as JSON and CSV records) becomes a missing column at plan. Under fail the plan blocks the table; otherwise plan warns and the load fills NULL. This replaces the "pinned column ... was not seen in the sampled files" note. A pin close to a sampled name (a typo, or another case) still fails. - Python tables: once the function has yielded every row, declared columns no row had are warned of, or fail the table under fail. A replace keeps the old table, as its rows swap in only at the end, and a table the failed load created is dropped again unless rows were committed to it. An append that committed on the way keeps those rows. - Reporting: TableSpec::missing_columns, TableLoaded::missing_columns and ProjectPlan::missing_columns carry the list in the library; plan --json lists it under missing_columns per table, and load --json on each table result. Both are left out when empty. BREAKING CHANGE: under on_schema_change = "fail", a JSON or CSV files table that pins a key no sampled file holds (one only older files have) now fails plan; before, plan only noted it. Parquet tables with such a pin, which failed plan under every setting, now load it as NULL unless on_schema_change = "fail".
kvlonge
force-pushed
the
feat/missing-declared-columns
branch
from
November 26, 2026 01:58
b1380dc to
cc2f4b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A column declared in
columnsthat the data lacks now followson_schema_change. Before, it failedplanoutright (Parquet files) or loaded as NULL silently (Python tables).on_schema_changeappend_new_columns(default)ignorefailA declared column is never dropped.
Changes
failthe plan blocks the table. Otherwise the plan warns and the load fills NULL. This replaces thepinned column ... was not seen in the sampled filesnote that JSON and CSV tables showed. A pin close to a sampled name (a typo, or a different case) still fails, as before.columnsorparsekeys). Underfailthe table fails instead. A function that yields no rows reports nothing.TableSpec::missing_columns,TableLoaded::missing_columnsandProjectPlan::missing_columns.plan --jsonlists it undermissing_columns, one{table, columns}per table, andload --jsongivesmissing_columnson each table result. Both are left out when empty, so existing JSON output does not change.failleaves behind for Python tables.Breaking change
Under
on_schema_change = "fail", a JSON or CSV files table that pins a key no sampled file holds now failsplan. That covers a key only older files have. Before,planonly showed a note. The commit isfeat!with aBREAKING CHANGE:footer. Parquet tables with such a pin used to failplanunder every setting. They now load the column as NULL unless the setting isfail.Python tables under
failThe check runs once every row is in, at the end of the load:
replace: the new rows are staged and swapped in only after the whole load succeeds, so afailleaves the old table and its rows untouched.replace, and anappendthat would have committed once, so no empty table is left visible.appendthat committed on the way (about every 1 GB, or perbatch_sizewindow): it keeps the rows those commits loaded. The contracts docs say so.Tests
given_a_declared_column_missing_from_the_files_when_loading_then_on_schema_change_decides(loader tests): NDJSON and Parquet under all three values. Parquet is covered both when DuckDB reads the files itself and when SQLLoad's reader does (test_loader_route). The column loads asDATE, all NULL.given_declared_columns_the_data_lacks_when_on_schema_change_decides_then_each_warns_or_the_table_fails(unit test).append_new_columns,ignoreandfail(the failed first load leaves no table). Areplaceunderfail: an existing table keeps its old rows, and a first load leaves no table. A declared column that is NULL in every row keeps its declared type with no warning. A files table'splan --jsonandload --jsonboth list the column.