-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 6866/model-versions2
- Loading branch information
Showing
62 changed files
with
1,954 additions
and
1,610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Added prettier printing to ContractError class | ||
time: 2023-03-25T19:28:30.171461-07:00 | ||
custom: | ||
Author: kentkr | ||
Issue: "7209" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Add support for model-level constraints | ||
time: 2023-03-29T10:27:36.94177-04:00 | ||
custom: | ||
Author: peterallenwebb | ||
Issue: "6754" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Add --no-populate-cache to optionally skip relation cache population | ||
time: 2023-04-10T11:55:38.360997-05:00 | ||
custom: | ||
Author: stu-k | ||
Issue: "1751" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Features | ||
body: Add relation info (database, schema, alias) to node_info dictionary in structured | ||
logging | ||
time: 2023-04-10T17:48:24.870944+02:00 | ||
custom: | ||
Author: jtcohen6 | ||
Issue: "6724" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: select resources by patch path | ||
time: 2023-04-11T08:46:45.641682-05:00 | ||
custom: | ||
Author: dave-connors-3 | ||
Issue: "7315" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Handle internal exceptions | ||
time: 2023-03-29T11:32:03.259072-05:00 | ||
custom: | ||
Author: stu-k | ||
Issue: "7118" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: avoid dbtRunner default callbacks being shared across instances | ||
time: 2023-04-05T12:43:15.418016-04:00 | ||
custom: | ||
Author: chamini2 | ||
Issue: "7278" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Fixes | ||
body: Duplicated flags now throw errors instead of being overidden by parent-level | ||
flag | ||
time: 2023-04-10T10:50:07.178386-05:00 | ||
custom: | ||
Author: iknox-fa | ||
Issue: "6913" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Generalize constraint compatibility warnings | ||
time: 2023-03-31T13:21:19.507995-05:00 | ||
custom: | ||
Author: emmyoop | ||
Issue: "7067" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Add unique_id to ShowNode and CompiledNode logging events | ||
time: 2023-04-10T14:02:28.86602-04:00 | ||
custom: | ||
Author: gshank | ||
Issue: "7305" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: '`Parse` now returns manifest when invoked via dbtRunner' | ||
time: 2023-04-10T16:45:43.17915-05:00 | ||
custom: | ||
Author: iknox-fa | ||
Issue: "6547" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Prettify message for ListRelations event | ||
time: 2023-04-10T21:47:24.052122+02:00 | ||
custom: | ||
Author: jtcohen6 | ||
Issue: "7310" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
# these are all just exports, #noqa them so flake8 will be happy | ||
|
||
# TODO: Should we still include this in the `adapters` namespace? | ||
from dbt.contracts.connection import Credentials # noqa | ||
from dbt.adapters.base.meta import available # noqa | ||
from dbt.adapters.base.connections import BaseConnectionManager # noqa | ||
from dbt.adapters.base.relation import ( # noqa | ||
from dbt.contracts.connection import Credentials # noqa: F401 | ||
from dbt.adapters.base.meta import available # noqa: F401 | ||
from dbt.adapters.base.connections import BaseConnectionManager # noqa: F401 | ||
from dbt.adapters.base.relation import ( # noqa: F401 | ||
BaseRelation, | ||
RelationType, | ||
SchemaSearchMap, | ||
) | ||
from dbt.adapters.base.column import Column # noqa | ||
from dbt.adapters.base.impl import AdapterConfig, BaseAdapter, PythonJobHelper # noqa | ||
from dbt.adapters.base.plugin import AdapterPlugin # noqa | ||
from dbt.adapters.base.column import Column # noqa: F401 | ||
from dbt.adapters.base.impl import ( # noqa: F401 | ||
AdapterConfig, | ||
BaseAdapter, | ||
PythonJobHelper, | ||
ConstraintSupport, | ||
) | ||
from dbt.adapters.base.plugin import AdapterPlugin # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,49 @@ | ||
TODO | ||
# Exception Handling | ||
|
||
## `requires.py` | ||
|
||
### `postflight` | ||
In the postflight decorator, the click command is invoked (i.e. `func(*args, **kwargs)`) and wrapped in a `try/except` block to handle any exceptions thrown. | ||
Any exceptions thrown from `postflight` are wrapped by custom exceptions from the `dbt.cli.exceptions` module (i.e. `ResultExit`, `ExceptionExit`) to instruct click to complete execution with a particular exit code. | ||
|
||
Some `dbt-core` handled exceptions have an attribute named `results` which contains results from running nodes (e.g. `FailFastError`). These are wrapped in the `ResultExit` exception to represent runs that have failed in a way that `dbt-core` expects. | ||
If the invocation of the command does not throw any exceptions but does not succeed, `postflight` will still raise the `ResultExit` exception to make use of the exit code. | ||
These exceptions produce an exit code of `1`. | ||
|
||
Exceptions wrapped with `ExceptionExit` may be thrown by `dbt-core` intentionally (i.e. an exception that inherits from `dbt.exceptions.Exception`) or unintentionally (i.e. exceptions thrown by the python runtime). In either case these are considered errors that `dbt-core` did not expect and are treated as genuine exceptions. | ||
These exceptions produce an exit code of `2`. | ||
|
||
If no exceptions are thrown from invoking the command and the command succeeds, `postflight` will not raise any exceptions. | ||
When no exceptions are raised an exit code of `0` is produced. | ||
|
||
## `main.py` | ||
|
||
### `dbtRunner` | ||
`dbtRunner` provides a programmatic interface for our click CLI and wraps the invocation of the click commands to handle any exceptions thrown. | ||
|
||
`dbtRunner.invoke` should ideally only ever return an instantiated `dbtRunnerResult` which contains the following fields: | ||
- `success`: A boolean representing whether the command invocation was successful | ||
- `result`: The optional result of the command invoked. This attribute can have many types, please see the definition of `dbtRunnerResult` for more information | ||
- `exception`: If an exception was thrown during command invocation it will be saved here, otherwise it will be `None`. Please note that the exceptions held in this attribute are not the exceptions thrown by `preflight` but instead the exceptions that `ResultExit` and `ExceptionExit` wrap | ||
|
||
Programmatic exception handling might look like the following: | ||
```python | ||
res = dbtRunner().invoke(["run"]) | ||
if not res.success: | ||
... | ||
if type(res.exception) == SomeExceptionType: | ||
... | ||
``` | ||
|
||
## `dbt/tests/util.py` | ||
|
||
### `run_dbt` | ||
In many of our functional and integration tests, we want to be sure that an invocation of `dbt` raises a certain exception. | ||
A common pattern for these assertions: | ||
```python | ||
class TestSomething: | ||
def test_something(self, project): | ||
with pytest.raises(SomeException): | ||
run_dbt(["run"]) | ||
``` | ||
To allow these tests to assert that exceptions have been thrown, the `run_dbt` function will raise any exceptions it recieves from the invocation of a `dbt` command. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.