jkolash commented on issue #2514:
URL:
https://github.com/apache/iceberg-python/issues/2514#issuecomment-3329870604
For reference this is something basic that I used to get secrets
interpolation from 1 password working.
# secure_catalog_load.py
```python
import subprocess
from pyiceberg.catalog import load_catalog
from pyiceberg.catalog import _ENV_CONFIG as DEFAULT_CONFIGS
def get_op_secret(name):
result = subprocess.run(["op", "read", name], capture_output=True,
text=True, check=True)
return result.stdout.strip()
def interpolate_secrets(config):
def interpolate_secret(key, value):
if value.startswith("op://"):
return get_op_secret(value)
else:
return value
return { key: (interpolate_secret(key, value) )
for key, value in config.items() }
def catalog_load(catalog_name):
raw_configs = DEFAULT_CONFIGS.get_catalog_config(catalog_name)
configs = interpolate_secrets(raw_configs)
return load_catalog(catalog_name, **configs)
```
--
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]