Commit d888dd1
authored
fix(config): let an explicitly falsy value on the right-hand side win in merge_config (#4005)
fix(config): let an explicitly falsy value on the right-hand side win
merge_config() documents 'take the non-null value, with precedence on
rhs', but it used `rhs_value or lhs_value`, which falls back to the
left-hand side for any falsy value, not just None.
load_catalog(name, **properties) merges the configuration file into the
caller's properties, so turning an option off explicitly was silently
ignored when the file set it:
# .pyiceberg.yaml has s3.path-style-access: "true"
load_catalog("prod", **{"s3.path-style-access": False})
# -> 's3.path-style-access' stays 'true'
That contradicts the intent of #45, which made the passed-in argument
take precedence over the environment. property_as_bool() in the same
codebase already distinguishes 'not set' from falsy by testing against
(None, ""), so the two now agree.
None on the right-hand side still means 'not set' and keeps the
left-hand value.1 parent 4dba4a4 commit d888dd1
2 files changed
Lines changed: 26 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
90 | 112 | | |
91 | 113 | | |
92 | 114 | | |
| |||
0 commit comments