Skip to content

Commit

Permalink
feat: add skip add data types flag
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Mar 29, 2024
1 parent d7e09e7 commit 7756a80
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changes/0.12.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.12.8 - 2024-03-29
### Added
* Add a `--skip-add-data-types` flag
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## 0.12.8 - 2024-03-29
### Added
* Add a `--skip-add-data-types` flag

## 0.12.7 - 2024-03-28
### Added
* Add a --use-unrendered-descriptions flag which allows doc block propagation
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dbt-osmosis"
version = "0.12.7"
version = "0.12.8"
description = "A dbt server and suite of optional developer tools to make developing with dbt delightful."
authors = ["z3z1ma <[email protected]>"]
license = "Apache-2.0"
Expand Down
4 changes: 4 additions & 0 deletions src/dbt_osmosis/core/osmosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __init__(
models: Optional[List[str]] = None,
skip_add_columns: bool = False,
skip_add_tags: bool = False,
skip_add_data_types: bool = False,
skip_merge_meta: bool = False,
add_progenitor_to_meta: bool = False,
vars: Optional[str] = None,
Expand All @@ -118,6 +119,7 @@ def __init__(
self._catalog: Optional[CatalogArtifact] = None
self.skip_add_columns = skip_add_columns
self.skip_add_tags = skip_add_tags
self.skip_add_data_types = skip_add_data_types
self.skip_merge_meta = skip_merge_meta
self.add_progenitor_to_meta = add_progenitor_to_meta
self.use_unrendered_descriptions = use_unrendered_descriptions
Expand Down Expand Up @@ -999,6 +1001,8 @@ def update_columns_data_type(
columns_db_meta: Dict[str, ColumnMetadata],
) -> int:
changes_committed = 0
if not self.skip_add_data_types:
return changes_committed
for column in columns_db_meta:
cased_column_name = self.column_casing(column)
if cased_column_name in node.columns:
Expand Down
21 changes: 21 additions & 0 deletions src/dbt_osmosis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def wrapper(*args, **kwargs):
is_flag=True,
help="If specified, we will skip adding tags to the models.",
)
@click.option(
"--skip-add-data-types",
is_flag=True,
help="If specified, we will skip adding data types to the models.",
)
@click.option(
"--skip-merge-meta",
is_flag=True,
Expand Down Expand Up @@ -184,6 +189,7 @@ def refactor(
check: bool = False,
skip_add_columns: bool = False,
skip_add_tags: bool = False,
skip_add_data_types: bool = False,
skip_merge_meta: bool = False,
add_progenitor_to_meta: bool = False,
models: Optional[List[str]] = None,
Expand Down Expand Up @@ -215,6 +221,7 @@ def refactor(
catalog_file=catalog_file,
skip_add_columns=skip_add_columns,
skip_add_tags=skip_add_tags,
skip_add_data_types=skip_add_data_types,
skip_merge_meta=skip_merge_meta,
add_progenitor_to_meta=add_progenitor_to_meta,
profile=profile,
Expand Down Expand Up @@ -267,6 +274,11 @@ def refactor(
is_flag=True,
help="If specified, we will skip adding tags to the models.",
)
@click.option(
"--skip-add-data-types",
is_flag=True,
help="If specified, we will skip adding data types to the models.",
)
@click.option(
"--skip-merge-meta",
is_flag=True,
Expand Down Expand Up @@ -306,6 +318,7 @@ def organize(
models: Optional[List[str]] = None,
skip_add_columns: bool = False,
skip_add_tags: bool = False,
skip_add_data_types: bool = False,
skip_merge_meta: bool = False,
add_progenitor_to_meta: bool = False,
profile: Optional[str] = None,
Expand Down Expand Up @@ -333,6 +346,7 @@ def organize(
models=models,
skip_add_columns=skip_add_columns,
skip_add_tags=skip_add_tags,
skip_add_data_types=skip_add_data_types,
skip_merge_meta=skip_merge_meta,
add_progenitor_to_meta=add_progenitor_to_meta,
profile=profile,
Expand Down Expand Up @@ -399,6 +413,11 @@ def organize(
is_flag=True,
help="If specified, we will skip adding tags to the models.",
)
@click.option(
"--skip-add-data-types",
is_flag=True,
help="If specified, we will skip adding data types to the models.",
)
@click.option(
"--skip-merge-meta",
is_flag=True,
Expand Down Expand Up @@ -448,6 +467,7 @@ def document(
models: Optional[List[str]] = None,
skip_add_columns: bool = False,
skip_add_tags: bool = False,
skip_add_data_types: bool = False,
skip_merge_meta: bool = False,
add_progenitor_to_meta: bool = False,
profile: Optional[str] = None,
Expand Down Expand Up @@ -477,6 +497,7 @@ def document(
catalog_file=catalog_file,
skip_add_columns=skip_add_columns,
skip_add_tags=skip_add_tags,
skip_add_data_types=skip_add_data_types,
skip_merge_meta=skip_merge_meta,
add_progenitor_to_meta=add_progenitor_to_meta,
profile=profile,
Expand Down

0 comments on commit 7756a80

Please sign in to comment.