Skip to content

feat: Auto schema evolution revisited - #9799

Open
k-anshul wants to merge 6 commits into
mainfrom
auto_schema_evolution
Open

feat: Auto schema evolution revisited#9799
k-anshul wants to merge 6 commits into
mainfrom
auto_schema_evolution

Conversation

@k-anshul

@k-anshul k-anshul commented Aug 10, 2026

Copy link
Copy Markdown
Member

Revisiting an old feature that allow automatic schema evolution. Our current approach of ingesting data in a new table for partition overwrite and merge strategy makes it much easier to implement now. Thus it is only supported for partition_overwrite and merge strategy based incremental ingestion(ideally we should just remove append strategy but that is discussion for some other issue/alternatively we can modify append strategy to also ingest data in a temporary table first).
This will avoid complicated pre_exec statements that we need to do that which should also ensure that full rebuild can still be supported.
Three strategies are implemented:

  1. Fail : Fail if any column is added or removed. Datatype changes are not compared as of now and we let db do automatic translation or fail. Set as default for backward compatibility.
  2. Ignore: Ignores new columns but fails if column is removed.
  3. append_new_columns: Appends new columns by automatically altering current table.

Note: The implementation is similar to dbt's schema evolution approach but we avoid adding sync_all_columns strategy which also alter data types. It has several nuances which dbt also misses like datatype detected to a narrower datatype than source data, whether auto conversion to string should be allowed, whether we should let duckdb do lossy conversion like timestamp to date type etc. This can be revisited to only allow wider datatype conversions.

Future improvements:

  1. Add sync_all_columns strategy as detailed in note above.
  2. Also implement for clickhouse.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@k-anshul k-anshul self-assigned this Aug 10, 2026
@k-anshul k-anshul changed the title DRAFT: feat: Auto schema evolution revisited. DRAFT: feat: Auto schema evolution revisited Aug 10, 2026
@k-anshul
k-anshul marked this pull request as ready for review August 12, 2026 07:53
@k-anshul k-anshul changed the title DRAFT: feat: Auto schema evolution revisited feat: Auto schema evolution revisited Aug 12, 2026
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