Skip to content

Commit f33bba0

Browse files
authored
expose merge method in python (#1372)
1 parent 0c594e4 commit f33bba0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

icechunk-python/python/icechunk/_icechunk_python.pyi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,25 @@ class RepositoryConfig:
13601360
Clear all virtual chunk containers from the repository.
13611361
"""
13621362
...
1363+
def merge(self, other: RepositoryConfig) -> RepositoryConfig:
1364+
"""
1365+
Merge another RepositoryConfig with this one.
1366+
1367+
When merging, values from the other config take precedence. For nested configs
1368+
(compression, caching, manifest, storage), the merge is applied recursively.
1369+
For virtual_chunk_containers, entries from the other config extend this one.
1370+
1371+
Parameters
1372+
----------
1373+
other: RepositoryConfig
1374+
The configuration to merge with this one.
1375+
1376+
Returns
1377+
-------
1378+
RepositoryConfig
1379+
A new merged configuration.
1380+
"""
1381+
...
13631382

13641383
class Diff:
13651384
"""The result of comparing two snapshots"""

icechunk-python/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,12 @@ impl PyRepositoryConfig {
15941594
Ok(c.get_virtual_chunk_container(name).map(|c| c.clone().into()))
15951595
}
15961596

1597+
pub fn merge(&self, other: &PyRepositoryConfig) -> PyResult<PyRepositoryConfig> {
1598+
let this: RepositoryConfig = self.try_into().map_err(PyValueError::new_err)?;
1599+
let other: RepositoryConfig = other.try_into().map_err(PyValueError::new_err)?;
1600+
Ok(this.merge(other).into())
1601+
}
1602+
15971603
pub fn __repr__(&self) -> String {
15981604
#[allow(clippy::expect_used)]
15991605
Python::attach(|py| {

0 commit comments

Comments
 (0)