gedaliakliger opened a new pull request, #4531:
URL: https://github.com/apache/iceberg-python/pull/4531

   Closes #4525
   
   # Rationale for this change
   
   `SqlCatalog` now handles the `exists` namespace property the way Java's 
`JdbcCatalog` does:
   
   - `create_namespace` always stores `exists=true` next to the given 
properties (`JdbcCatalog.createNamespace`).
   - `load_namespace_properties` no longer returns it 
(`JdbcCatalog.loadNamespaceMetadata`).
   - `update_namespace_properties` raises `ValueError("Cannot set reserved 
property: exists")` when `updates` contains it (`JdbcCatalog.setProperties`). 
`create_namespace` raises the same error; Java fails there too, because 
`buildOrThrow` rejects the duplicate key.
   
   Two deviations from Java:
   
   - A removal of `exists` is skipped and reported under `missing`. 
`JdbcCatalog.removeProperties` has no guard and would delete the row. Since the 
property is hidden from `load_namespace_properties`, deleting it would 
contradict the returned summary.
   - The re-insert from #4503 stays, for namespaces that released versions 
created with properties and therefore without the marker. It now checks whether 
any row remains instead of whether any visible property remains.
   
   ## Are these changes tested?
   
   Yes. `test_namespace_rejects_reserved_exists_property` and 
`test_namespace_created_with_properties_survives_external_property_removal` are 
new, and `test_load_empty_namespace_properties` and 
`test_update_namespace_properties_removes_all_properties` now expect `{}`. The 
four fail on `main` (28 cases) and pass with this change.
   
   Ran locally: `pytest tests/catalog/test_catalog_behaviors.py 
tests/catalog/test_sql.py tests/catalog/test_base.py tests/cli -m unit` (971 
passed), and ruff, ruff-format and mypy on the changed files. The full suite 
and the integration tests are left to CI.
   
   ## Are there any user-facing changes?
   
   Yes, for the release notes:
   
   - `load_namespace_properties` on a `SqlCatalog` or `InMemoryCatalog` no 
longer returns `exists`. A namespace created without properties returns `{}` 
instead of `{"exists": "true"}`.
   - `create_namespace` and `update_namespace_properties` raise `ValueError` 
when given `exists` as a property key.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to