apache / apache/iceberg-python

Discrepency in the fetched table properties

Open
#3,247 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
581
Avg merge
1d 17h
Merged PRs (30d)
78

Description

### Apache Iceberg version

None

### Please describe the bug 🐞

I am using Apache Polaris as catalog and when i load the table using pyiceberg, the response has config that is different from what i get when i use Polaris CLI and not only that when i use the file system from this table, i am getting `Permission Denied` errors, suggesting the credentials in the table are wrong.

Details:

```
polaris --profile root tables get --catalog "senec_catalog" --namespace "Senec.Stage.Bronze.Ampace_V3LFP" "BmsAmpaceV3ModuleMeasurement"
```
returns a table with the config property as follows:
```
, "config": {"s3.path-style-access": "true", "s3.endpoint": "http://localhost:9008"}
```

however, the rest api cal inside `catalog.load_table(table_identifier)` has a response that contains the config that looks like this:
```
{'s3.path-style-access': 'true', 's3.access-key-id': 'NFAIYHBUDHR1VBDHR8G0', 's3.secret-access
-key': 'L4Q_0W4We1ClcHsg8t0A5RcazPu4Xx1TR9P5-fbn', 's3.session-token': '***', 'client.refresh-credentials-endpoint': 'v1/senec_catalog/namespaces/Senec%1FStage%1FBronze%1FAmpace_V3LFP/tables/BmsAmpaceV3ModuleMeasurement/credentials', '
expiration-time': '1776355429000', 's3.endpoint': 'http://localhost:9008', 's3.session-token-e
xpires-at-ms': '1776355429000'}
```
which would have been okay but using a filesystem created using the io from this table is always resulting in permission errors, so i have to manually set the table properties like so:

```
self.tbl.io.properties["s3.endpoint"] = self.catalog.properties["s3.endpoint"]
self.tbl.io.properties["s3.endpoint"] = self.catalog.properties.get("s3.endpoint")
self.tbl.io.properties["s3.access-key-id"] = self.catalog.properties.get("s3.access-key-id")
self.tbl.io.properties["s3.secret-access-key"] = self.catalog.properties.get("s3.secret-access-key")
self.tbl.io.properties.pop("s3.session-token", None)
```

Could anyone tell me why is this the case? This is related to #1958 as i am trying to use the filesystem to delete the orphan files.

### Willingness to contribute

- [ ] I can contribute a fix for this bug independently
- [x] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at catalog.load_table(table_identifier) and trace how the returned table config is passed into the filesystem created from table.io. Reproduce the discrepancy with the shown Polaris CLI and REST calls, then verify that the filesystem uses the returned endpoint and credentials without manual property mutation. Add a regression test if the repository has coverage for catalog-loaded table properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.