You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+115-9Lines changed: 115 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,23 +79,80 @@ def _build_catalog(self):
79
79
80
80
## Implementation Gotchas For Subclasses
81
81
82
-
### Mixed catalogs: math references alongside raw references
82
+
### `name` is the catalog key — never mutate it directly
83
83
84
-
When a `DataCatalog` contains both raw `DataReference` entries and `MathDataReference` entries (mixed catalog), rows produced by `to_dataframe().reset_index()` will have `NaN` in the `source` column for math references, because derived references have no file source.
84
+
`DataCatalog._references` is an `OrderedDict` keyed by `ref.name`. If you mutate
85
+
`ref.name` directly the dictionary key becomes stale and every subsequent
86
+
`catalog.get(ref.name)` raises `KeyError`.
85
87
86
-
**`get_data_reference` must guard against NaN source**
88
+
**Always rename via `catalog.rename(old_name, new_name)`**, which atomically updates
89
+
both the key and `ref.name`:
87
90
88
-
Raw entries are keyed by their auto-derived name (from `primary_key` values). Math entries are keyed by their `name` alone. The safe pattern:
91
+
```python
92
+
catalog.rename("JER__tf", "JER_tidal_filtered") # chainable, raises KeyError / ValueError on conflicts
93
+
```
94
+
95
+
`rename()` does **not** affect `_source_index` — the source (file path) is unchanged.
96
+
97
+
### `name` vs display label in mixed catalogs
98
+
99
+
`name` serves two roles that can conflict:
100
+
101
+
| Role | Raw DSS example | Transform ref example |
0 commit comments