Repository navigation
[python] Support getting a table by id in the REST catalog - #10697
Open
plusplusjiajia wants to merge 1 commit into
Open
plusplusjiajia wants to merge 1 commit into
plusplusjiajia wants to merge 1 commit into
Conversation
plusplusjiajia
force-pushed
the
feat/python-get-table-by-id
branch
2 times, most recently
from
October 20, 2026 11:14
2b177b3 to
d14e4c2
Compare
plusplusjiajia
marked this pull request as ready for review
October 20, 2026 11:23
Java has Catalog#getTableById since apache#7085, but pypaimon could only load a table by name. Add Catalog.get_table_by_id, implemented by RESTCatalog on GET /v1/{prefix}/tables/id/{tableId}. As in Java, the table is built from the database and name in the response, a 404 raises TableIdNotExistException and a 403 raises TableIdNoPermissionException. Other catalogs raise NotImplementedError. As in table_details, '~' stays raw in the path, so the DLF signature covers the path requests sends. GetTableResponse now keeps the database field the server sends. It is left out of the JSON when unknown, since native readers only reuse a REST response whose database matches the table.
plusplusjiajia
force-pushed
the
feat/python-get-table-by-id
branch
from
October 21, 2026 07:10
d14e4c2 to
54f0b3d
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.
Purpose
Java has had
Catalog#getTableByIdsince #7085, but pypaimon can only load a table by name. This addsCatalog.get_table_by_id(table_id).RESTCatalogimplements it onGET /v1/{prefix}/tables/id/{tableId}. As in Java, the table is built from the database and name in the response, a 404 raisesTableIdNotExistException, and a 403 raisesTableIdNoPermissionException. Other catalogs raiseNotImplementedError.GetTableResponsenow keeps thedatabasefield that the server sends, which Java already reads. It is left out of the JSON when it isNone, because native readers reuse a REST response only when its database matches the table's.table_details,~stays raw in the path:requestssends%7Eas~after the DLF signer has signed the path.Tests
RESTCatalogTest#test_get_table_by_id: loads a table by id from a database with a dot in its name, checks its identifier and path, checks that native readers can reuse the response, and reads back the written row. It also checks the exceptions for an unknown id and for a table without permission.ApiTest:RESTApi.get_table_by_idagainst the mock server and the empty-id check. A fixed JSON fixture, as the Java server sends it, checks thatdatabaseis parsed and written under that key, and that it is left out whenNone.native_plan_rest_test.py#test_rest_dotted_database_and_table_keep_identitygains a case that loads the table by id and reads it through the native planner and reader, with no fallback to Python and no catalog reload.ResourcePathsTest#test_signature_matches_the_path_sentnow also covers the table-id path, for both DLF signing algorithms.RESTApiCoverageTestchecks the new request against the OpenAPI spec and the openapi-v4 actions.database, as the Java server does.pypaimon/tests/restand the native-plan tests: 631 pass. The one failure, the Lance-format commit test, needslance, which is not installed locally. The new tests also pass on Python 3.6, and flake8 is clean.pypaimon-rustbuilt from paimon-rust main and the native flags on, the REST and native tests fail the same way as on master: tests that needrayorlance, Avro reads oflong-dt, and the flaky shard tests inpy36/ao_simple_test.py.