diff --git a/.changes/1.1.13.md b/.changes/1.1.13.md new file mode 100644 index 0000000..5bb0c94 --- /dev/null +++ b/.changes/1.1.13.md @@ -0,0 +1,5 @@ +## 1.1.13 - 2025-01-31 +### Added +* Allow anchoring yml paths to the models base directory with leading `/` +### Fixed +* Include the record column itself when flattening struct types diff --git a/.changes/unreleased/Added-20250130-234300.yaml b/.changes/unreleased/Added-20250130-234300.yaml deleted file mode 100644 index ed61663..0000000 --- a/.changes/unreleased/Added-20250130-234300.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Allow anchoring yml paths to the models base directory -time: 2025-01-30T23:43:00.049818-07:00 diff --git a/CHANGELOG.md b/CHANGELOG.md index d949ff8..5fbdc9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## 1.1.13 - 2025-01-31 +### Added +* Allow anchoring yml paths to the models base directory with leading `/` +### Fixed +* Include the record column itself when flattening struct types + ## 1.1.12 - 2025-01-30 ### Fixed * Ensure we don't recurse in flattening struct columns as the adapter is already recursive under the hood diff --git a/pyproject.toml b/pyproject.toml index b47cf2d..379015f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "dbt-osmosis" -version = "1.1.12" +version = "1.1.13" description = "A dbt utility for managing YAML to make developing with dbt more delightful." readme = "README.md" license = { text = "Apache-2.0" } diff --git a/src/dbt_osmosis/core/osmosis.py b/src/dbt_osmosis/core/osmosis.py index 8e5aef7..e22e8a6 100644 --- a/src/dbt_osmosis/core/osmosis.py +++ b/src/dbt_osmosis/core/osmosis.py @@ -853,14 +853,12 @@ def get_columns(context: YamlRefactorContext, ref: TableRef) -> dict[str, Column normalized_cols = OrderedDict() offset = 0 - def process_column(col: BaseColumn | ColumnMetadata) -> None: + def process_column(c: BaseColumn | ColumnMetadata, /) -> None: nonlocal offset - if hasattr(col, "flatten"): - # flatten bq structs - cols = getattr(col, "flatten")() - else: - cols = [col] + cols = [c] + if hasattr(c, "flatten"): + cols.extend(getattr(c, "flatten")()) for col in cols: if any(re.match(b, col.name) for b in context.ignore_patterns):