fix: add iceberg_type column for SqlCatalog#3263
Open
rchowell wants to merge 1 commit intoapache:mainfrom
Open
fix: add iceberg_type column for SqlCatalog#3263rchowell wants to merge 1 commit intoapache:mainfrom
rchowell wants to merge 1 commit intoapache:mainfrom
Conversation
geruh
reviewed
Apr 21, 2026
Member
geruh
left a comment
There was a problem hiding this comment.
Thanks for raising this @rchowell! This is a matter of completing the implementation of our SqlCatalog. Here you are updating the table to have the column and handle the migration logic.
We will definitely need a follow up here to filter against this column for table operations. Looks like the java v1 implementation runs something like WHERE (iceberg_type = 'TABLE' OR iceberg_type IS NULL) Otherwise, a view can bleed into table operations.
| catalog_sqlite.close() | ||
|
|
||
|
|
||
| def _create_pre_migration_schema_tables(engine: Engine) -> None: |
Member
There was a problem hiding this comment.
Doesn't look like you're calling this function but the logic is used on like 302+ below?
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.
Rationale for this change
Pyiceberg currently does not include the
iceberg_typecolumn in theiceberg_tablestable for SQL-based catalogs. This caused an error when reading a SQL-based Catalog from iceberg-rust, which expected this column. I will also update iceberg-rust to be more defensive like this PR.The fix here is done exactly how iceberg-java handles this. We do an idempotent
ALTER TABLE iceberg_tables ADD COLUMN iceberg_typeafter ensuringiceberg_tablesexists. We explicitly use the try/catch to make it idempotent because older sqlite versions do not supportIF NOT EXISTSfor column creation. For newly created tables, the addition to the sqlalchemy table will create the column. For existing tables, this backwards-compatible schema update will hit.Are these changes tested?
Unit Testing
End-to-end Testing
Are there any user-facing changes?
No