Skip to content

Commit

Permalink
fix: ensure records and structs are flattened
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Jan 30, 2025
1 parent 6e60bbd commit 09f435d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .changes/1.1.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 1.1.11 - 2025-01-30
### Fixed
* Ensure records and structs are flattened
* Leverage data_type prop on adapter column if mode is present
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## 1.1.11 - 2025-01-30
### Fixed
* Ensure records and structs are flattened
* Leverage data_type prop on adapter column if mode is present

## 1.1.10 - 2025-01-29
### Added
* Match on corresponding node when passing yaml file path(s) in positional selectors ie like with pre-commit
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "dbt-osmosis"
version = "1.1.10"
version = "1.1.11"
description = "A dbt utility for managing YAML to make developing with dbt more delightful."
readme = "README.md"
license = { text = "Apache-2.0" }
Expand Down
10 changes: 7 additions & 3 deletions src/dbt_osmosis/core/osmosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ def _maybe_use_precise_dtype(
if (col.is_numeric() and use_num_prec) or (col.is_string() and use_chr_prec):
logger.debug(":ruler: Using precise data type => %s", col.data_type)
return col.data_type
if hasattr(col, "mode"):
return col.data_type
return col.dtype


Expand Down Expand Up @@ -859,12 +861,14 @@ def process_column(col: BaseColumn | ColumnMetadata):
)
return
normalized = normalize_column_name(col.name, context.project.runtime_cfg.credentials.type)
if not isinstance(col, ColumnMetadata):
if isinstance(col, ColumnMetadata):
col_meta = col
else:
dtype = _maybe_use_precise_dtype(col, context.settings)
col = ColumnMetadata(
col_meta = ColumnMetadata(
name=normalized, type=dtype, index=offset, comment=getattr(col, "comment", None)
)
normalized_cols[normalized] = col
normalized_cols[normalized] = col_meta
offset += 1
if hasattr(col, "flatten"):
for struct_field in t.cast(Iterable[BaseColumn], getattr(col, "flatten")()):
Expand Down

0 comments on commit 09f435d

Please sign in to comment.