Skip to content

Commit

Permalink
Merge branch '1.7.latest' into ADAP-9681/fix_renamed_relations_overri…
Browse files Browse the repository at this point in the history
…de_pre_1.8
  • Loading branch information
mikealfare authored Mar 21, 2024
2 parents f2c0f7d + a0372fc commit bf52e55
Show file tree
Hide file tree
Showing 30 changed files with 377 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.7.8
current_version = 1.7.10
parse = (?P<major>[\d]+) # major version number
\.(?P<minor>[\d]+) # minor version number
\.(?P<patch>[\d]+) # patch version number
Expand Down
11 changes: 11 additions & 0 deletions .changes/1.7.10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## dbt-core 1.7.10 - March 14, 2024

### Fixes

- Do not add duplicate input_measures ([#9360](https://github.com/dbt-labs/dbt-core/issues/9360))
- Fix partial parsing `KeyError` on deleted schema files ([#8860](https://github.com/dbt-labs/dbt-core/issues/8860))
- Support saved queries in `dbt list` ([#9532](https://github.com/dbt-labs/dbt-core/issues/9532))

### Dependencies

- Restrict protobuf to 4.* versions ([#9566](https://github.com/dbt-labs/dbt-core/pull/9566))
18 changes: 18 additions & 0 deletions .changes/1.7.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## dbt-core 1.7.9 - February 28, 2024

### Fixes

- Fix node_info contextvar handling so incorrect node_info doesn't persist ([#8866](https://github.com/dbt-labs/dbt-core/issues/8866))
- Add target-path to retry ([#8948](https://github.com/dbt-labs/dbt-core/issues/8948))

### Under the Hood

- Make dbt-core compatible with Python 3.12 ([#9007](https://github.com/dbt-labs/dbt-core/issues/9007))
- Restrict protobuf to major version 4. ([#9566](https://github.com/dbt-labs/dbt-core/issues/9566))

### Security

- Update Jinja2 to >= 3.1.3 to address CVE-2024-22195 ([#CVE-2024-22195](https://github.com/dbt-labs/dbt-core/pull/CVE-2024-22195))

### Contributors
- [@l1xnan](https://github.com/l1xnan) ([#9007](https://github.com/dbt-labs/dbt-core/issues/9007))
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240216-145632.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Tighten exception handling to avoid worker thread hangs.
time: 2024-02-16T14:56:32.858967-05:00
custom:
Author: peterallenwebb
Issue: "9583"
6 changes: 0 additions & 6 deletions .changes/unreleased/Fixes-20240222-100958.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .changes/unreleased/Fixes-20240223-162107.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .changes/unreleased/Security-20240222-152445.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .changes/unreleased/Under the Hood-20240221-104518.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .changes/unreleased/Under the Hood-20240221-145058.yaml

This file was deleted.

35 changes: 33 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,46 @@
- "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version.
- Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry)

## dbt-core 1.7.10 - March 14, 2024

### Fixes

- Do not add duplicate input_measures ([#9360](https://github.com/dbt-labs/dbt-core/issues/9360))
- Fix partial parsing `KeyError` on deleted schema files ([#8860](https://github.com/dbt-labs/dbt-core/issues/8860))
- Support saved queries in `dbt list` ([#9532](https://github.com/dbt-labs/dbt-core/issues/9532))

### Dependencies

- Restrict protobuf to 4.* versions ([#9566](https://github.com/dbt-labs/dbt-core/pull/9566))



## dbt-core 1.7.9 - February 28, 2024

### Fixes

- Fix node_info contextvar handling so incorrect node_info doesn't persist ([#8866](https://github.com/dbt-labs/dbt-core/issues/8866))
- Add target-path to retry ([#8948](https://github.com/dbt-labs/dbt-core/issues/8948))

### Under the Hood

- Make dbt-core compatible with Python 3.12 ([#9007](https://github.com/dbt-labs/dbt-core/issues/9007))
- Restrict protobuf to major version 4. ([#9566](https://github.com/dbt-labs/dbt-core/issues/9566))

### Security

- Update Jinja2 to >= 3.1.3 to address CVE-2024-22195 ([#CVE-2024-22195](https://github.com/dbt-labs/dbt-core/pull/CVE-2024-22195))

### Contributors
- [@l1xnan](https://github.com/l1xnan) ([#9007](https://github.com/dbt-labs/dbt-core/issues/9007))

## dbt-core 1.7.8 - February 14, 2024

### Fixes

- When patching versioned models, set constraints after config ([#9364](https://github.com/dbt-labs/dbt-core/issues/9364))
- Store node_info in node associated logging events ([#9557](https://github.com/dbt-labs/dbt-core/issues/9557))



## dbt-core 1.7.7 - February 01, 2024

### Fixes
Expand Down
1 change: 1 addition & 0 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
[
"metric",
"semantic_model",
"saved_query",
"source",
"analysis",
"model",
Expand Down
6 changes: 6 additions & 0 deletions core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,12 @@ def same_contents(self, old: Optional["Metric"]) -> bool:
and True
)

def add_input_measure(self, input_measure: MetricInputMeasure) -> None:
for existing_input_measure in self.type_params.input_measures:
if input_measure == existing_input_measure:
return
self.type_params.input_measures.append(input_measure)


# ====================================
# Group node
Expand Down
9 changes: 5 additions & 4 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ def _process_metric_node(
assert (
metric.type_params.measure is not None
), f"{metric} should have a measure defined, but it does not."
metric.type_params.input_measures.append(metric.type_params.measure)
metric.add_input_measure(metric.type_params.measure)
_process_metric_depends_on(
manifest=manifest, current_project=current_project, metric=metric
)
Expand All @@ -1581,8 +1581,8 @@ def _process_metric_node(
assert (
conversion_type_params
), f"{metric.name} is a conversion metric and must have conversion_type_params defined."
metric.type_params.input_measures.append(conversion_type_params.base_measure)
metric.type_params.input_measures.append(conversion_type_params.conversion_measure)
metric.add_input_measure(conversion_type_params.base_measure)
metric.add_input_measure(conversion_type_params.conversion_measure)
_process_metric_depends_on(
manifest=manifest, current_project=current_project, metric=metric
)
Expand Down Expand Up @@ -1618,7 +1618,8 @@ def _process_metric_node(
_process_metric_node(
manifest=manifest, current_project=current_project, metric=target_metric
)
metric.type_params.input_measures.extend(target_metric.type_params.input_measures)
for input_measure in target_metric.type_params.input_measures:
metric.add_input_measure(input_measure)
metric.depends_on.add_node(target_metric.unique_id)
else:
assert_values_exhausted(metric.type)
Expand Down
7 changes: 6 additions & 1 deletion core/dbt/parser/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def add_to_pp_files(self, source_file):
if (
file_id not in self.project_parser_files[project_name][parser_name]
and file_id not in self.file_diff["deleted"]
and file_id not in self.file_diff["deleted_schema_files"]
):
self.project_parser_files[project_name][parser_name].append(file_id)

Expand Down Expand Up @@ -446,7 +447,11 @@ def schedule_nodes_for_parsing(self, unique_ids):

def _schedule_for_parsing(self, dict_key: str, element, name, delete: Callable) -> None:
file_id = element.file_id
if file_id in self.saved_files and file_id not in self.file_diff["deleted"]:
if (
file_id in self.saved_files
and file_id not in self.file_diff["deleted"]
and file_id not in self.file_diff["deleted_schema_files"]
):
schema_file = self.saved_files[file_id]
elements = []
assert isinstance(schema_file, SchemaSourceFile)
Expand Down
42 changes: 42 additions & 0 deletions core/dbt/task/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# Task README

### Task Hierarchy
```
BaseTask
┣ CleanTask
┣ ConfiguredTask
┃ ┣ GraphRunnableTask
┃ ┃ ┣ CloneTask
┃ ┃ ┣ CompileTask
┃ ┃ ┃ ┣ GenerateTask
┃ ┃ ┃ ┣ RunTask
┃ ┃ ┃ ┃ ┣ BuildTask
┃ ┃ ┃ ┃ ┣ FreshnessTask
┃ ┃ ┃ ┃ ┣ SeedTask
┃ ┃ ┃ ┃ ┣ SnapshotTask
┃ ┃ ┃ ┃ ┗ TestTask
┃ ┃ ┃ ┗ ShowTask
┃ ┃ ┗ ListTask
┃ ┣ RetryTask
┃ ┣ RunOperationTask
┃ ┗ ServeTask
┣ DebugTask
┣ DepsTask
┗ InitTask
```

### Runner Hierarchy
```
BaseRunner
┣ CloneRunner
┣ CompileRunner
┃ ┣ GenericSqlRunner
┃ ┃ ┣ SqlCompileRunner
┃ ┃ ┗ SqlExecuteRunner
┃ ┣ ModelRunner
┃ ┃ ┣ SeedRunner
┃ ┃ ┗ SnapshotRunner
┃ ┣ ShowRunner
┃ ┗ TestRunner
┣ FreshnessRunner
┗ SavedQueryRunner
```
17 changes: 15 additions & 2 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import json

from dbt.contracts.graph.nodes import Exposure, SourceDefinition, Metric, SemanticModel
from dbt.contracts.graph.nodes import (
Exposure,
SourceDefinition,
Metric,
SavedQuery,
SemanticModel,
)
from dbt.flags import get_flags
from dbt.graph import ResourceTypeSelector
from dbt.task.runnable import GraphRunnableTask
Expand Down Expand Up @@ -28,6 +34,7 @@ class ListTask(GraphRunnableTask):
NodeType.Source,
NodeType.Exposure,
NodeType.Metric,
NodeType.SavedQuery,
NodeType.SemanticModel,
)
)
Expand Down Expand Up @@ -77,10 +84,12 @@ def _iterate_selected_nodes(self):
yield self.manifest.metrics[node]
elif node in self.manifest.semantic_models:
yield self.manifest.semantic_models[node]
elif node in self.manifest.saved_queries:
yield self.manifest.saved_queries[node]
else:
raise DbtRuntimeError(
f'Got an unexpected result from node selection: "{node}"'
f"Expected a source or a node!"
f"Listing this node type is not yet supported!"
)

def generate_selectors(self):
Expand All @@ -100,6 +109,10 @@ def generate_selectors(self):
# metrics are searched for by pkg.metric_name
metric_selector = ".".join([node.package_name, node.name])
yield f"metric:{metric_selector}"
elif node.resource_type == NodeType.SavedQuery:
assert isinstance(node, SavedQuery)
saved_query_selector = ".".join([node.package_name, node.name])
yield f"saved_query:{saved_query_selector}"
elif node.resource_type == NodeType.SemanticModel:
assert isinstance(node, SemanticModel)
semantic_model_selector = ".".join([node.package_name, node.name])
Expand Down
38 changes: 33 additions & 5 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
ConcurrencyLine,
EndRunResult,
NothingToDo,
GenericExceptionOnRun,
)
from dbt.exceptions import (
DbtInternalError,
Expand Down Expand Up @@ -204,17 +205,44 @@ def call_runner(self, runner: BaseRunner) -> RunResult:
)
)
status: Dict[str, str] = {}
result = None
thread_exception = None
try:
result = runner.run_with_hooks(self.manifest)
except Exception as e:
thread_exception = e
finally:
finishctx = TimestampNamed("finished_at")
with finishctx, DbtModelState(status):
fire_event(
NodeFinished(
node_info=runner.node.node_info,
run_result=result.to_msg_dict(),
if result is not None:
fire_event(
NodeFinished(
node_info=runner.node.node_info,
run_result=result.to_msg_dict(),
)
)
)
else:
msg = f"Exception on worker thread. {thread_exception}"

fire_event(
GenericExceptionOnRun(
unique_id=runner.node.unique_id,
exc=str(thread_exception),
node_info=runner.node.node_info,
)
)

result = RunResult(
status=RunStatus.Error, # type: ignore
timing=[],
thread_id="",
execution_time=0.0,
adapter_response={},
message=msg,
failures=None,
node=runner.node,
)

# `_event_status` dict is only used for logging. Make sure
# it gets deleted when we're done with it
runner.node.clear_event_status()
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,5 @@ def _get_adapter_plugin_names() -> Iterator[str]:
yield plugin_name


__version__ = "1.7.8"
__version__ = "1.7.10"
installed = get_installed_version()
4 changes: 2 additions & 2 deletions core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


package_name = "dbt-core"
package_version = "1.7.8"
package_version = "1.7.10"
description = """With dbt, data analysts and engineers can build analytics \
the way engineers build applications."""

Expand Down Expand Up @@ -79,7 +79,7 @@
# Expect compatibility with all new versions of these packages, so lower bounds only.
"jsonschema>=3.0",
"packaging>20.9",
"protobuf>=4.0.0",
"protobuf>=4.0.0,<5",
"pytz>=2015.7",
"pyyaml>=6.0",
"typing-extensions>=3.7.4",
Expand Down
12 changes: 6 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ FROM --platform=$build_for python:3.10.7-slim-bullseye as base
# N.B. The refs updated automagically every release via bumpversion
# N.B. dbt-postgres is currently found in the core codebase so a value of dbt-core@<some_version> is correct

ARG [email protected].8
ARG [email protected].8
ARG [email protected].8
ARG [email protected].8
ARG [email protected].8
ARG [email protected].8
ARG [email protected].10
ARG [email protected].10
ARG [email protected].10
ARG [email protected].10
ARG [email protected].10
ARG [email protected].10
# special case args
ARG dbt_spark_version=all
ARG dbt_third_party
Expand Down
2 changes: 1 addition & 1 deletion plugins/postgres/dbt/adapters/postgres/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.7.8"
version = "1.7.10"
Loading

0 comments on commit bf52e55

Please sign in to comment.