From 0953b8f38855b6379478735e0a82a8382df07d53 Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Tue, 7 Feb 2023 11:51:55 -0800 Subject: [PATCH] Fix log format (#118) * Fix log format * Add changelog --- CHANGELOG.md | 1 + prefect_dbt/cli/configs/base.py | 2 +- tests/cli/configs/test_base.py | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9b09e..e600ee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Preventing `TargetConfigs` from being dropped upon loading a `DbtCliProfile` - [#115](https://github.com/PrefectHQ/prefect-dbt/pull/115) +- The input type of `GlobalConfigs.log_format` [#118](https://github.com/PrefectHQ/prefect-dbt/pull/118) ### Security diff --git a/prefect_dbt/cli/configs/base.py b/prefect_dbt/cli/configs/base.py index 760af1c..270ae1e 100644 --- a/prefect_dbt/cli/configs/base.py +++ b/prefect_dbt/cli/configs/base.py @@ -201,7 +201,7 @@ class GlobalConfigs(DbtConfigs): default=None, description="Whether to convert dbt warnings into errors.", ) - log_format: Optional[bool] = Field( + log_format: Optional[str] = Field( default=None, description=( "The LOG_FORMAT config specifies how dbt's logs should " diff --git a/tests/cli/configs/test_base.py b/tests/cli/configs/test_base.py index 5c3534e..5f9c750 100644 --- a/tests/cli/configs/test_base.py +++ b/tests/cli/configs/test_base.py @@ -1,6 +1,6 @@ import pytest -from prefect_dbt.cli.configs.base import TargetConfigs +from prefect_dbt.cli.configs.base import GlobalConfigs, TargetConfigs def test_target_configs_get_configs(): @@ -26,3 +26,9 @@ def test_target_configs_get_configs_duplicate_keys(): extras={"extra_input": 1, "schema": "something else"}, ) target_configs.get_configs() + + +def test_global_configs(): + global_configs = GlobalConfigs(log_format="json", send_anonymous_usage_stats=False) + assert global_configs.log_format == "json" + assert global_configs.send_anonymous_usage_stats is False