Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4006] replace logger.warning with warn_or_error #4019

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Enable cataloging of unlogged Postgres tables ([3961](https://github.com/dbt-labs/dbt/issues/3961), [#3993](https://github.com/dbt-labs/dbt/pull/3993))
- Fix multiple disabled nodes ([#4013](https://github.com/dbt-labs/dbt/issues/4013), [#4018](https://github.com/dbt-labs/dbt/pull/4018))
- Fix multiple partial parsing errors ([#3996](https://github.com/dbt-labs/dbt/issues/3006), [#4020](https://github.com/dbt-labs/dbt/pull/4018))
- Return an error instead of a warning when runing with `--warn-error` and no models are selected ([#4006](https://github.com/dbt-labs/dbt/issues/4006), [#4019](https://github.com/dbt-labs/dbt/pull/4019))

### Under the hood

Expand All @@ -38,6 +39,7 @@ Contributors:
- [@kadero](https://github.com/kadero) ([#3952](https://github.com/dbt-labs/dbt/pull/3953))
- [@samlader](https://github.com/samlader) ([#3993](https://github.com/dbt-labs/dbt/pull/3993))
- [@yu-iskw](https://github.com/yu-iskw) ([#3967](https://github.com/dbt-labs/dbt/pull/3967))
- [@laxjesse](https://github.com/laxjesse) ([#4019](https://github.com/dbt-labs/dbt/pull/4019))

## dbt 0.21.0 (October 04, 2021)

Expand Down
6 changes: 3 additions & 3 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from dbt.task.runnable import GraphRunnableTask, ManifestTask
from dbt.task.test import TestSelector
from dbt.node_types import NodeType
from dbt.exceptions import RuntimeException, InternalException
from dbt.logger import log_manager, GLOBAL_LOGGER as logger
from dbt.exceptions import RuntimeException, InternalException, warn_or_error
from dbt.logger import log_manager


class ListTask(GraphRunnableTask):
Expand Down Expand Up @@ -61,7 +61,7 @@ def _iterate_selected_nodes(self):
spec = self.get_selection_spec()
nodes = sorted(selector.get_selected(spec))
if not nodes:
logger.warning('No nodes selected!')
warn_or_error('No nodes selected!')
return
if self.manifest is None:
raise InternalException(
Expand Down
5 changes: 3 additions & 2 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
NotImplementedException,
RuntimeException,
FailFastException,
warn_or_error,
)

from dbt.graph import (
Expand Down Expand Up @@ -443,8 +444,8 @@ def run(self):
)

if len(self._flattened_nodes) == 0:
logger.warning("\nWARNING: Nothing to do. Try checking your model "
"configs and model specification args")
warn_or_error("\nWARNING: Nothing to do. Try checking your model "
"configs and model specification args")
result = self.get_result(
results=[],
generated_at=datetime.utcnow(),
Expand Down