forked from repo-mirrors/dbt-core
Compare commits
3 Commits
adding-sem
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f43a1c297 | ||
|
|
11e155de86 | ||
|
|
823aa0a575 |
@@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 1.5.0a1
|
current_version = 1.3.0b2
|
||||||
parse = (?P<major>\d+)
|
parse = (?P<major>\d+)
|
||||||
\.(?P<minor>\d+)
|
\.(?P<minor>\d+)
|
||||||
\.(?P<patch>\d+)
|
\.(?P<patch>\d+)
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
For information on prior major and minor releases, see their changelogs:
|
For information on prior major and minor releases, see their changelogs:
|
||||||
|
|
||||||
|
|
||||||
* [1.4](https://github.com/dbt-labs/dbt-core/blob/1.4.latest/CHANGELOG.md)
|
|
||||||
* [1.3](https://github.com/dbt-labs/dbt-core/blob/1.3.latest/CHANGELOG.md)
|
|
||||||
* [1.2](https://github.com/dbt-labs/dbt-core/blob/1.2.latest/CHANGELOG.md)
|
* [1.2](https://github.com/dbt-labs/dbt-core/blob/1.2.latest/CHANGELOG.md)
|
||||||
* [1.1](https://github.com/dbt-labs/dbt-core/blob/1.1.latest/CHANGELOG.md)
|
* [1.1](https://github.com/dbt-labs/dbt-core/blob/1.1.latest/CHANGELOG.md)
|
||||||
* [1.0](https://github.com/dbt-labs/dbt-core/blob/1.0.latest/CHANGELOG.md)
|
* [1.0](https://github.com/dbt-labs/dbt-core/blob/1.0.latest/CHANGELOG.md)
|
||||||
|
|||||||
38
.changes/1.3.0-b1.md
Normal file
38
.changes/1.3.0-b1.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
## dbt-core 1.3.0-b1 - July 29, 2022
|
||||||
|
### Features
|
||||||
|
- Python model inital version ([#5261](https://github.com/dbt-labs/dbt-core/issues/5261), [#5421](https://github.com/dbt-labs/dbt-core/pull/5421))
|
||||||
|
- allows user to include the file extension for .py models in the dbt run -m command. ([#5289](https://github.com/dbt-labs/dbt-core/issues/5289), [#5295](https://github.com/dbt-labs/dbt-core/pull/5295))
|
||||||
|
- Incremental materialization refactor and cleanup ([#5245](https://github.com/dbt-labs/dbt-core/issues/5245), [#5359](https://github.com/dbt-labs/dbt-core/pull/5359))
|
||||||
|
- Python models can support incremental logic ([#0](https://github.com/dbt-labs/dbt-core/issues/0), [#35](https://github.com/dbt-labs/dbt-core/pull/35))
|
||||||
|
- Add reusable function for retrying adapter connections. Utilize said function to add retries for Postgres (and Redshift). ([#5022](https://github.com/dbt-labs/dbt-core/issues/5022), [#5432](https://github.com/dbt-labs/dbt-core/pull/5432))
|
||||||
|
- add exponential backoff to connection retries on Postgres (and Redshift) ([#5502](https://github.com/dbt-labs/dbt-core/issues/5502), [#5503](https://github.com/dbt-labs/dbt-core/pull/5503))
|
||||||
|
### Fixes
|
||||||
|
- Add context to compilation errors generated while rendering generic test configuration values. ([#5294](https://github.com/dbt-labs/dbt-core/issues/5294), [#5393](https://github.com/dbt-labs/dbt-core/pull/5393))
|
||||||
|
- Rename try to strict for more intuitiveness ([#5475](https://github.com/dbt-labs/dbt-core/issues/5475), [#5477](https://github.com/dbt-labs/dbt-core/pull/5477))
|
||||||
|
- Ignore empty strings passed in as secrets ([#5312](https://github.com/dbt-labs/dbt-core/issues/5312), [#5518](https://github.com/dbt-labs/dbt-core/pull/5518))
|
||||||
|
- Fix handling of top-level exceptions ([#5564](https://github.com/dbt-labs/dbt-core/issues/5564), [#5560](https://github.com/dbt-labs/dbt-core/pull/5560))
|
||||||
|
### Docs
|
||||||
|
- Update dependency inline-source from ^6.1.5 to ^7.2.0 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency jest from ^26.2.2 to ^28.1.3 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency underscore from ^1.9.0 to ^1.13.4 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency webpack-cli from ^3.3.12 to ^4.7.0 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency webpack-dev-server from ^3.1.11 to ^4.9.3 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Searches no longer require perfect matches, and instead consider each word individually. `my model` or `model my` will now find `my_model`, without the need for underscores ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Support the renaming of SQL to code happening in dbt-core ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
### Under the Hood
|
||||||
|
- Added language to tracked fields in run_model event ([#5571](https://github.com/dbt-labs/dbt-core/issues/5571), [#5469](https://github.com/dbt-labs/dbt-core/pull/5469))
|
||||||
|
- Update mashumaro to 3.0.3 ([#4940](https://github.com/dbt-labs/dbt-core/issues/4940), [#5118](https://github.com/dbt-labs/dbt-core/pull/5118))
|
||||||
|
- Add python incremental materialization test ([#0000](https://github.com/dbt-labs/dbt-core/issues/0000), [#5571](https://github.com/dbt-labs/dbt-core/pull/5571))
|
||||||
|
### Dependencies
|
||||||
|
- Upgrade to Jinja2==3.1.2 from Jinja2==2.11.3 ([#4748](https://github.com/dbt-labs/dbt-core/issues/4748), [#5465](https://github.com/dbt-labs/dbt-core/pull/5465))
|
||||||
|
- Bump mypy from 0.961 to 0.971 ([#4904](https://github.com/dbt-labs/dbt-core/issues/4904), [#5495](https://github.com/dbt-labs/dbt-core/pull/5495))
|
||||||
|
- Remove pin for MarkUpSafe from >=0.23,<2.1 ([#5506](https://github.com/dbt-labs/dbt-core/issues/5506), [#5507](https://github.com/dbt-labs/dbt-core/pull/5507))
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
- [@Goodkat](https://github.com/Goodkat) ([#5518](https://github.com/dbt-labs/dbt-core/pull/5518))
|
||||||
|
- [@drewbanin](https://github.com/drewbanin) ([#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- [@jeremyyeo](https://github.com/jeremyyeo) ([#5477](https://github.com/dbt-labs/dbt-core/pull/5477))
|
||||||
|
- [@joellabes](https://github.com/joellabes) ([#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- [@leoebfolsom](https://github.com/leoebfolsom) ([#5295](https://github.com/dbt-labs/dbt-core/pull/5295))
|
||||||
|
- [@nicholasyager](https://github.com/nicholasyager) ([#5393](https://github.com/dbt-labs/dbt-core/pull/5393))
|
||||||
|
- [@tomasfarias](https://github.com/tomasfarias) ([#5432](https://github.com/dbt-labs/dbt-core/pull/5432))
|
||||||
49
.changes/1.3.0-b2.md
Normal file
49
.changes/1.3.0-b2.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
## dbt-core 1.3.0-b2 - August 29, 2022
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Add `--defer` flag to dbt compile & dbt docs generate ([#4110](https://github.com/dbt-labs/dbt-core/issues/4110), [#4514](https://github.com/dbt-labs/dbt-core/pull/4514))
|
||||||
|
- use MethodName.File when value ends with .csv ([#5578](https://github.com/dbt-labs/dbt-core/issues/5578), [#5581](https://github.com/dbt-labs/dbt-core/pull/5581))
|
||||||
|
- Make `docs` configurable in `dbt_project.yml` and add a `node_color` attribute to change the color of nodes in the DAG ([#5333](https://github.com/dbt-labs/dbt-core/issues/5333), [#5397](https://github.com/dbt-labs/dbt-core/pull/5397))
|
||||||
|
- Adding ResolvedMetricReference helper functions and tests ([#5567](https://github.com/dbt-labs/dbt-core/issues/5567), [#5607](https://github.com/dbt-labs/dbt-core/pull/5607))
|
||||||
|
- Check dbt-core version requirements when installing Hub packages ([#5648](https://github.com/dbt-labs/dbt-core/issues/5648), [#5651](https://github.com/dbt-labs/dbt-core/pull/5651))
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- Remove the default 256 characters limit on postgres character varying type when no limitation is set ([#5238](https://github.com/dbt-labs/dbt-core/issues/5238), [#5292](https://github.com/dbt-labs/dbt-core/pull/5292))
|
||||||
|
- Include schema file config in unrendered_config ([#5338](https://github.com/dbt-labs/dbt-core/issues/5338), [#5344](https://github.com/dbt-labs/dbt-core/pull/5344))
|
||||||
|
- Resolves #5351 - Do not consider shorter varchar cols as schema changes ([#5351](https://github.com/dbt-labs/dbt-core/issues/5351), [#5395](https://github.com/dbt-labs/dbt-core/pull/5395))
|
||||||
|
- on_shchma_change fail verbosity enhancement ([#5504](https://github.com/dbt-labs/dbt-core/issues/5504), [#5505](https://github.com/dbt-labs/dbt-core/pull/5505))
|
||||||
|
- Fix error rendering docs block in metrics description ([#5585](https://github.com/dbt-labs/dbt-core/issues/5585), [#5603](https://github.com/dbt-labs/dbt-core/pull/5603))
|
||||||
|
- Extended validations for the project names ([#5379](https://github.com/dbt-labs/dbt-core/issues/5379), [#5620](https://github.com/dbt-labs/dbt-core/pull/5620))
|
||||||
|
- Use sys.exit instead of exit ([#5621](https://github.com/dbt-labs/dbt-core/issues/5621), [#5627](https://github.com/dbt-labs/dbt-core/pull/5627))
|
||||||
|
- Finishing logic upgrade to Redshift for name truncation collisions. ([#5586](https://github.com/dbt-labs/dbt-core/issues/5586), [#5656](https://github.com/dbt-labs/dbt-core/pull/5656))
|
||||||
|
- multiple args for ref and source ([#5634](https://github.com/dbt-labs/dbt-core/issues/5634), [#5635](https://github.com/dbt-labs/dbt-core/pull/5635))
|
||||||
|
- Fix Unexpected behavior when chaining methods on dbt-ref'ed/sourced dataframes ([#5646](https://github.com/dbt-labs/dbt-core/issues/5646), [#5677](https://github.com/dbt-labs/dbt-core/pull/5677))
|
||||||
|
|
||||||
|
### Docs
|
||||||
|
|
||||||
|
- Leverages `docs.node_color` from `dbt-core` to color nodes in the DAG ([dbt-docs/#44](https://github.com/dbt-labs/dbt-docs/issues/44), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
|
||||||
|
### Under the Hood
|
||||||
|
|
||||||
|
- Save use of default env vars to manifest to enable partial parsing in those cases. ([#5155](https://github.com/dbt-labs/dbt-core/issues/5155), [#5589](https://github.com/dbt-labs/dbt-core/pull/5589))
|
||||||
|
- add more information to log line interop test failures ([#5658](https://github.com/dbt-labs/dbt-core/issues/5658), [#5659](https://github.com/dbt-labs/dbt-core/pull/5659))
|
||||||
|
- Add supported languages to materializations ([#5569](https://github.com/dbt-labs/dbt-core/issues/5569), [#5695](https://github.com/dbt-labs/dbt-core/pull/5695))
|
||||||
|
|
||||||
|
### Dependency
|
||||||
|
|
||||||
|
- Bump python from 3.10.5-slim-bullseye to 3.10.6-slim-bullseye in /docker ([#4904](https://github.com/dbt-labs/dbt-core/issues/4904), [#5623](https://github.com/dbt-labs/dbt-core/pull/5623))
|
||||||
|
- Bump mashumaro[msgpack] from 3.0.3 to 3.0.4 in /core ([#4904](https://github.com/dbt-labs/dbt-core/issues/4904), [#5649](https://github.com/dbt-labs/dbt-core/pull/5649))
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
- [@Goodkat](https://github.com/Goodkat) ([#5581](https://github.com/dbt-labs/dbt-core/pull/5581), [#5620](https://github.com/dbt-labs/dbt-core/pull/5620))
|
||||||
|
- [@Ilanbenb](https://github.com/Ilanbenb) ([#5505](https://github.com/dbt-labs/dbt-core/pull/5505))
|
||||||
|
- [@b-per](https://github.com/b-per) ([#5397](https://github.com/dbt-labs/dbt-core/pull/5397), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
- [@callum-mcdata](https://github.com/callum-mcdata) ([#5607](https://github.com/dbt-labs/dbt-core/pull/5607))
|
||||||
|
- [@epapineau](https://github.com/epapineau) ([#5395](https://github.com/dbt-labs/dbt-core/pull/5395))
|
||||||
|
- [@kadero](https://github.com/kadero) ([#4514](https://github.com/dbt-labs/dbt-core/pull/4514))
|
||||||
|
- [@matt-winkler](https://github.com/matt-winkler) ([#5397](https://github.com/dbt-labs/dbt-core/pull/5397), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
- [@shrodingers](https://github.com/shrodingers) ([#5292](https://github.com/dbt-labs/dbt-core/pull/5292))
|
||||||
|
- [@sungchun12](https://github.com/sungchun12) ([#5397](https://github.com/dbt-labs/dbt-core/pull/5397), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
- [@varun-dc](https://github.com/varun-dc) ([#5627](https://github.com/dbt-labs/dbt-core/pull/5627))
|
||||||
7
.changes/1.3.0/Dependencies-20220719-141646.yaml
Normal file
7
.changes/1.3.0/Dependencies-20220719-141646.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Dependencies
|
||||||
|
body: Upgrade to Jinja2==3.1.2 from Jinja2==2.11.3
|
||||||
|
time: 2022-07-19T14:16:46.665631-05:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "4748"
|
||||||
|
PR: "5465"
|
||||||
7
.changes/1.3.0/Dependencies-20220720-000741.yaml
Normal file
7
.changes/1.3.0/Dependencies-20220720-000741.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Dependencies
|
||||||
|
body: "Bump mypy from 0.961 to 0.971"
|
||||||
|
time: 2022-07-20T00:07:41.000000-05:00
|
||||||
|
custom:
|
||||||
|
Author: dependabot[bot]
|
||||||
|
Issue: "4904"
|
||||||
|
PR: "5495"
|
||||||
7
.changes/1.3.0/Dependencies-20220721-093233.yaml
Normal file
7
.changes/1.3.0/Dependencies-20220721-093233.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Dependencies
|
||||||
|
body: Remove pin for MarkUpSafe from >=0.23,<2.1
|
||||||
|
time: 2022-07-21T09:32:33.494002-05:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "5506"
|
||||||
|
PR: "5507"
|
||||||
7
.changes/1.3.0/Dependency-20220808-132327.yaml
Normal file
7
.changes/1.3.0/Dependency-20220808-132327.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Dependency
|
||||||
|
body: "Bump python from 3.10.5-slim-bullseye to 3.10.6-slim-bullseye in /docker"
|
||||||
|
time: 2022-08-08T13:23:27.00000Z
|
||||||
|
custom:
|
||||||
|
Author: dependabot[bot]
|
||||||
|
Issue: 4904
|
||||||
|
PR: 5623
|
||||||
7
.changes/1.3.0/Dependency-20220815-182731.yaml
Normal file
7
.changes/1.3.0/Dependency-20220815-182731.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Dependency
|
||||||
|
body: "Bump mashumaro[msgpack] from 3.0.3 to 3.0.4 in /core"
|
||||||
|
time: 2022-08-15T18:27:31.00000Z
|
||||||
|
custom:
|
||||||
|
Author: dependabot[bot]
|
||||||
|
Issue: 4904
|
||||||
|
PR: 5649
|
||||||
7
.changes/1.3.0/Docs-20220728-140258.yaml
Normal file
7
.changes/1.3.0/Docs-20220728-140258.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Update dependency inline-source from ^6.1.5 to ^7.2.0
|
||||||
|
time: 2022-07-28T14:02:58.441963-07:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "299"
|
||||||
|
PR: "291"
|
||||||
7
.changes/1.3.0/Docs-20220728-140329.yaml
Normal file
7
.changes/1.3.0/Docs-20220728-140329.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Update dependency jest from ^26.2.2 to ^28.1.3
|
||||||
|
time: 2022-07-28T14:03:29.837274-07:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "299"
|
||||||
|
PR: "291"
|
||||||
7
.changes/1.3.0/Docs-20220728-140351.yaml
Normal file
7
.changes/1.3.0/Docs-20220728-140351.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Update dependency underscore from ^1.9.0 to ^1.13.4
|
||||||
|
time: 2022-07-28T14:03:51.123441-07:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "299"
|
||||||
|
PR: "291"
|
||||||
7
.changes/1.3.0/Docs-20220728-140425.yaml
Normal file
7
.changes/1.3.0/Docs-20220728-140425.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Update dependency webpack-cli from ^3.3.12 to ^4.7.0
|
||||||
|
time: 2022-07-28T14:04:25.629638-07:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "299"
|
||||||
|
PR: "291"
|
||||||
7
.changes/1.3.0/Docs-20220728-140449.yaml
Normal file
7
.changes/1.3.0/Docs-20220728-140449.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Update dependency webpack-dev-server from ^3.1.11 to ^4.9.3
|
||||||
|
time: 2022-07-28T14:04:49.637369-07:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "299"
|
||||||
|
PR: "291"
|
||||||
8
.changes/1.3.0/Docs-20220728-140620.yaml
Normal file
8
.changes/1.3.0/Docs-20220728-140620.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Searches no longer require perfect matches, and instead consider each word individually.
|
||||||
|
`my model` or `model my` will now find `my_model`, without the need for underscores
|
||||||
|
time: 2022-07-28T14:06:20.371364-07:00
|
||||||
|
custom:
|
||||||
|
Author: joellabes
|
||||||
|
Issue: "143"
|
||||||
|
PR: "145"
|
||||||
7
.changes/1.3.0/Docs-20220728-140806.yaml
Normal file
7
.changes/1.3.0/Docs-20220728-140806.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Support the renaming of SQL to code happening in dbt-core
|
||||||
|
time: 2022-07-28T14:08:06.184934-07:00
|
||||||
|
custom:
|
||||||
|
Author: jtcohen6 stu-k drewbanin ChenyuLInx
|
||||||
|
Issue: "299"
|
||||||
|
PR: "292"
|
||||||
7
.changes/1.3.0/Docs-20220804-134138.yaml
Normal file
7
.changes/1.3.0/Docs-20220804-134138.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Docs
|
||||||
|
body: Leverages `docs.node_color` from `dbt-core` to color nodes in the DAG
|
||||||
|
time: 2022-08-04T13:41:38.669987-05:00
|
||||||
|
custom:
|
||||||
|
Author: matt-winkler sungchun12 b-per
|
||||||
|
Issue: "44"
|
||||||
|
PR: "281"
|
||||||
7
.changes/1.3.0/Features-20220314-181127.yaml
Normal file
7
.changes/1.3.0/Features-20220314-181127.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Add `--defer` flag to dbt compile & dbt docs generate
|
||||||
|
time: 2022-03-14T18:11:27.783107864+01:00
|
||||||
|
custom:
|
||||||
|
Author: kadero
|
||||||
|
Issue: "4110"
|
||||||
|
PR: "4514"
|
||||||
7
.changes/1.3.0/Features-20220510-165130.yaml
Normal file
7
.changes/1.3.0/Features-20220510-165130.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Python model inital version
|
||||||
|
time: 2022-05-10T16:51:30.245589-07:00
|
||||||
|
custom:
|
||||||
|
Author: ChenyuLInx
|
||||||
|
Issue: "5261"
|
||||||
|
PR: "5421"
|
||||||
7
.changes/1.3.0/Features-20220526-165323.yaml
Normal file
7
.changes/1.3.0/Features-20220526-165323.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: allows user to include the file extension for .py models in the dbt run -m command.
|
||||||
|
time: 2022-05-26T16:53:23.389671-07:00
|
||||||
|
custom:
|
||||||
|
Author: leoebfolsom
|
||||||
|
Issue: "5289"
|
||||||
|
PR: "5295"
|
||||||
7
.changes/1.3.0/Features-20220610-105647.yaml
Normal file
7
.changes/1.3.0/Features-20220610-105647.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Incremental materialization refactor and cleanup
|
||||||
|
time: 2022-06-10T10:56:47.226887-04:00
|
||||||
|
custom:
|
||||||
|
Author: gshank
|
||||||
|
Issue: "5245"
|
||||||
|
PR: "5359"
|
||||||
7
.changes/1.3.0/Features-20220627-131042.yaml
Normal file
7
.changes/1.3.0/Features-20220627-131042.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Python models can support incremental logic
|
||||||
|
time: 2022-06-27T13:10:42.123303-05:00
|
||||||
|
custom:
|
||||||
|
Author: iknox-fa
|
||||||
|
Issue: "0"
|
||||||
|
PR: "35"
|
||||||
8
.changes/1.3.0/Features-20220715-035555.yaml
Normal file
8
.changes/1.3.0/Features-20220715-035555.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Add reusable function for retrying adapter connections. Utilize said function
|
||||||
|
to add retries for Postgres (and Redshift).
|
||||||
|
time: 2022-07-15T03:55:55.270637265+02:00
|
||||||
|
custom:
|
||||||
|
Author: tomasfarias
|
||||||
|
Issue: "5022"
|
||||||
|
PR: "5432"
|
||||||
7
.changes/1.3.0/Features-20220720-171257.yaml
Normal file
7
.changes/1.3.0/Features-20220720-171257.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: add exponential backoff to connection retries on Postgres (and Redshift)
|
||||||
|
time: 2022-07-20T17:12:57.486949-04:00
|
||||||
|
custom:
|
||||||
|
Author: nathaniel-may
|
||||||
|
Issue: "5502"
|
||||||
|
PR: "5503"
|
||||||
7
.changes/1.3.0/Features-20220729-173231.yaml
Normal file
7
.changes/1.3.0/Features-20220729-173231.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: use MethodName.File when value ends with .csv
|
||||||
|
time: 2022-07-29T17:32:31.395677157+02:00
|
||||||
|
custom:
|
||||||
|
Author: Goodkat
|
||||||
|
Issue: "5578"
|
||||||
|
PR: "5581"
|
||||||
8
.changes/1.3.0/Features-20220803-104230.yaml
Normal file
8
.changes/1.3.0/Features-20220803-104230.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Make `docs` configurable in `dbt_project.yml` and add a `node_color` attribute
|
||||||
|
to change the color of nodes in the DAG
|
||||||
|
time: 2022-08-03T10:42:30.60624+02:00
|
||||||
|
custom:
|
||||||
|
Author: matt-winkler sungchun12 b-per
|
||||||
|
Issue: "5333"
|
||||||
|
PR: "5397"
|
||||||
7
.changes/1.3.0/Features-20220804-120936.yaml
Normal file
7
.changes/1.3.0/Features-20220804-120936.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Adding ResolvedMetricReference helper functions and tests
|
||||||
|
time: 2022-08-04T12:09:36.202919-04:00
|
||||||
|
custom:
|
||||||
|
Author: callum-mcdata
|
||||||
|
Issue: "5567"
|
||||||
|
PR: "5607"
|
||||||
7
.changes/1.3.0/Features-20220815-134312.yaml
Normal file
7
.changes/1.3.0/Features-20220815-134312.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Check dbt-core version requirements when installing Hub packages
|
||||||
|
time: 2022-08-15T13:43:12.965143+01:00
|
||||||
|
custom:
|
||||||
|
Author: jtcohen6
|
||||||
|
Issue: "5648"
|
||||||
|
PR: "5651"
|
||||||
8
.changes/1.3.0/Fixes-20220523-103843.yaml
Normal file
8
.changes/1.3.0/Fixes-20220523-103843.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Remove the default 256 characters limit on postgres character varying type when
|
||||||
|
no limitation is set
|
||||||
|
time: 2022-05-23T10:38:43.392232+02:00
|
||||||
|
custom:
|
||||||
|
Author: shrodingers
|
||||||
|
Issue: "5238"
|
||||||
|
PR: "5292"
|
||||||
7
.changes/1.3.0/Fixes-20220607-123058.yaml
Normal file
7
.changes/1.3.0/Fixes-20220607-123058.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Include schema file config in unrendered_config
|
||||||
|
time: 2022-06-07T12:30:58.535207-04:00
|
||||||
|
custom:
|
||||||
|
Author: gshank
|
||||||
|
Issue: "5338"
|
||||||
|
PR: "5344"
|
||||||
7
.changes/1.3.0/Fixes-20220617-193731.yaml
Normal file
7
.changes/1.3.0/Fixes-20220617-193731.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: 'Resolves #5351 - Do not consider shorter varchar cols as schema changes'
|
||||||
|
time: 2022-06-17T19:37:31.885484-07:00
|
||||||
|
custom:
|
||||||
|
Author: epapineau
|
||||||
|
Issue: "5351"
|
||||||
|
PR: "5395"
|
||||||
7
.changes/1.3.0/Fixes-20220715-231148.yaml
Normal file
7
.changes/1.3.0/Fixes-20220715-231148.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Rename try to strict for more intuitiveness
|
||||||
|
time: 2022-07-15T23:11:48.327928+12:00
|
||||||
|
custom:
|
||||||
|
Author: jeremyyeo
|
||||||
|
Issue: "5475"
|
||||||
|
PR: "5477"
|
||||||
7
.changes/1.3.0/Fixes-20220720-213746.yaml
Normal file
7
.changes/1.3.0/Fixes-20220720-213746.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: on_shchma_change fail verbosity enhancement
|
||||||
|
time: 2022-07-20T21:37:46.474241+03:00
|
||||||
|
custom:
|
||||||
|
Author: Ilanbenb
|
||||||
|
Issue: "5504"
|
||||||
|
PR: "5505"
|
||||||
7
.changes/1.3.0/Fixes-20220723-215330.yaml
Normal file
7
.changes/1.3.0/Fixes-20220723-215330.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Ignore empty strings passed in as secrets
|
||||||
|
time: 2022-07-23T21:53:30.907759094+02:00
|
||||||
|
custom:
|
||||||
|
Author: Goodkat
|
||||||
|
Issue: "5312"
|
||||||
|
PR: "5518"
|
||||||
7
.changes/1.3.0/Fixes-20220726-113636.yaml
Normal file
7
.changes/1.3.0/Fixes-20220726-113636.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Fix handling of top-level exceptions
|
||||||
|
time: 2022-07-26T11:36:36.824979-04:00
|
||||||
|
custom:
|
||||||
|
Author: gshank
|
||||||
|
Issue: "5564"
|
||||||
|
PR: "5560"
|
||||||
7
.changes/1.3.0/Fixes-20220803-144221.yaml
Normal file
7
.changes/1.3.0/Fixes-20220803-144221.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Fix error rendering docs block in metrics description
|
||||||
|
time: 2022-08-03T14:42:21.386265-04:00
|
||||||
|
custom:
|
||||||
|
Author: gshank
|
||||||
|
Issue: "5585"
|
||||||
|
PR: "5603"
|
||||||
7
.changes/1.3.0/Fixes-20220805-221022.yaml
Normal file
7
.changes/1.3.0/Fixes-20220805-221022.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Extended validations for the project names
|
||||||
|
time: 2022-08-05T22:10:22.746830854+02:00
|
||||||
|
custom:
|
||||||
|
Author: Goodkat
|
||||||
|
Issue: "5379"
|
||||||
|
PR: "5620"
|
||||||
7
.changes/1.3.0/Fixes-20220808-112001.yaml
Normal file
7
.changes/1.3.0/Fixes-20220808-112001.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Use sys.exit instead of exit
|
||||||
|
time: 2022-08-08T11:20:01.838171926-04:00
|
||||||
|
custom:
|
||||||
|
Author: varun-dc
|
||||||
|
Issue: "5621"
|
||||||
|
PR: "5627"
|
||||||
7
.changes/1.3.0/Fixes-20220815-230409.yaml
Normal file
7
.changes/1.3.0/Fixes-20220815-230409.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Finishing logic upgrade to Redshift for name truncation collisions.
|
||||||
|
time: 2022-08-15T23:04:09.173645-07:00
|
||||||
|
custom:
|
||||||
|
Author: versusfacit
|
||||||
|
Issue: "5586"
|
||||||
|
PR: "5656"
|
||||||
7
.changes/1.3.0/Fixes-20220816-153401.yaml
Normal file
7
.changes/1.3.0/Fixes-20220816-153401.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: multiple args for ref and source
|
||||||
|
time: 2022-08-16T15:34:01.348339-07:00
|
||||||
|
custom:
|
||||||
|
Author: ChenyuLInx
|
||||||
|
Issue: "5634"
|
||||||
|
PR: "5635"
|
||||||
7
.changes/1.3.0/Fixes-20220817-163642.yaml
Normal file
7
.changes/1.3.0/Fixes-20220817-163642.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Fix Unexpected behavior when chaining methods on dbt-ref'ed/sourced dataframes
|
||||||
|
time: 2022-08-17T16:36:42.678275-07:00
|
||||||
|
custom:
|
||||||
|
Author: ChenyuLInx
|
||||||
|
Issue: "5646"
|
||||||
|
PR: "5677"
|
||||||
8
.changes/1.3.0/Under the Hood-20220617-150744.yaml
Normal file
8
.changes/1.3.0/Under the Hood-20220617-150744.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Add context to compilation errors generated while rendering generic test configuration
|
||||||
|
values.
|
||||||
|
time: 2022-06-17T15:07:44.751037-04:00
|
||||||
|
custom:
|
||||||
|
Author: nicholasyager
|
||||||
|
Issue: "5294"
|
||||||
|
PR: "5393"
|
||||||
7
.changes/1.3.0/Under the Hood-20220713-124925.yaml
Normal file
7
.changes/1.3.0/Under the Hood-20220713-124925.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Added language to tracked fields in run_model event
|
||||||
|
time: 2022-07-13T12:49:25.362678-05:00
|
||||||
|
custom:
|
||||||
|
Author: stu-k
|
||||||
|
Issue: "5571"
|
||||||
|
PR: "5469"
|
||||||
7
.changes/1.3.0/Under the Hood-20220720-115226.yaml
Normal file
7
.changes/1.3.0/Under the Hood-20220720-115226.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Update mashumaro to 3.0.3
|
||||||
|
time: 2022-07-20T11:52:26.210876-04:00
|
||||||
|
custom:
|
||||||
|
Author: gshank
|
||||||
|
Issue: "4940"
|
||||||
|
PR: "5118"
|
||||||
7
.changes/1.3.0/Under the Hood-20220728-094536.yaml
Normal file
7
.changes/1.3.0/Under the Hood-20220728-094536.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Add python incremental materialization test
|
||||||
|
time: 2022-07-28T09:45:36.13608-05:00
|
||||||
|
custom:
|
||||||
|
Author: stu-k
|
||||||
|
Issue: "0000"
|
||||||
|
PR: "5571"
|
||||||
8
.changes/1.3.0/Under the Hood-20220802-112936.yaml
Normal file
8
.changes/1.3.0/Under the Hood-20220802-112936.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Save use of default env vars to manifest to enable partial parsing in those
|
||||||
|
cases.
|
||||||
|
time: 2022-08-02T11:29:36.417589-05:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "5155"
|
||||||
|
PR: "5589"
|
||||||
7
.changes/1.3.0/Under the Hood-20220816-122032.yaml
Normal file
7
.changes/1.3.0/Under the Hood-20220816-122032.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: add more information to log line interop test failures
|
||||||
|
time: 2022-08-16T12:20:32.119588+01:00
|
||||||
|
custom:
|
||||||
|
Author: nathaniel-may
|
||||||
|
Issue: "5658"
|
||||||
|
PR: "5659"
|
||||||
7
.changes/1.3.0/Under the Hood-20220822-103739.yaml
Normal file
7
.changes/1.3.0/Under the Hood-20220822-103739.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Add supported languages to materializations
|
||||||
|
time: 2022-08-22T10:37:39.50743-05:00
|
||||||
|
custom:
|
||||||
|
Author: stu-k
|
||||||
|
Issue: "5569"
|
||||||
|
PR: "5695"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Breaking Changes
|
||||||
|
body: Renaming Metric Spec Attributes
|
||||||
|
time: 2022-09-06T15:45:21.2769-05:00
|
||||||
|
custom:
|
||||||
|
Author: callum-mcdata
|
||||||
|
Issue: "5774"
|
||||||
|
PR: "5775"
|
||||||
7
.changes/unreleased/Dependency-20220906-134858.yaml
Normal file
7
.changes/unreleased/Dependency-20220906-134858.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: "Dependency"
|
||||||
|
body: "Bump black from 22.6.0 to 22.8.0"
|
||||||
|
time: 2022-09-06T13:48:58.00000Z
|
||||||
|
custom:
|
||||||
|
Author: dependabot[bot]
|
||||||
|
Issue: 4904
|
||||||
|
PR: 5750
|
||||||
7
.changes/unreleased/Dependency-20220912-002253.yaml
Normal file
7
.changes/unreleased/Dependency-20220912-002253.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: "Dependency"
|
||||||
|
body: "Bump python from 3.10.6-slim-bullseye to 3.10.7-slim-bullseye in /docker"
|
||||||
|
time: 2022-09-12T00:22:53.00000Z
|
||||||
|
custom:
|
||||||
|
Author: dependabot[bot]
|
||||||
|
Issue: 4904
|
||||||
|
PR: 5805
|
||||||
7
.changes/unreleased/Features-20220831-121319.yaml
Normal file
7
.changes/unreleased/Features-20220831-121319.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Adding the `window` parameter to the metric spec.
|
||||||
|
time: 2022-08-31T12:13:19.48356-05:00
|
||||||
|
custom:
|
||||||
|
Author: callum-mcdata
|
||||||
|
Issue: "5721"
|
||||||
|
PR: "5722"
|
||||||
7
.changes/unreleased/Features-20220908-081315.yaml
Normal file
7
.changes/unreleased/Features-20220908-081315.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Add invocation args dict to ProviderContext class
|
||||||
|
time: 2022-09-08T08:13:15.17337+01:00
|
||||||
|
custom:
|
||||||
|
Author: jared-rimmer
|
||||||
|
Issue: "5524"
|
||||||
|
PR: "5782"
|
||||||
7
.changes/unreleased/Features-20220908-104149.yaml
Normal file
7
.changes/unreleased/Features-20220908-104149.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Adds new cli framework
|
||||||
|
time: 2022-09-08T10:41:49.375734-05:00
|
||||||
|
custom:
|
||||||
|
Author: iknox-fa
|
||||||
|
Issue: "5526"
|
||||||
|
PR: "5647"
|
||||||
7
.changes/unreleased/Features-20220913-095924.yaml
Normal file
7
.changes/unreleased/Features-20220913-095924.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: Add enabled config to exposures and metrics
|
||||||
|
time: 2022-09-13T09:59:24.445918-05:00
|
||||||
|
custom:
|
||||||
|
Author: emmyoop
|
||||||
|
Issue: "5422"
|
||||||
|
PR: "5815"
|
||||||
7
.changes/unreleased/Features-20220914-140511.yaml
Normal file
7
.changes/unreleased/Features-20220914-140511.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Features
|
||||||
|
body: add fill missing value attribute
|
||||||
|
time: 2022-09-14T14:05:11.927083-05:00
|
||||||
|
custom:
|
||||||
|
Author: dave-connors-3
|
||||||
|
Issue: "5842"
|
||||||
|
PR: "5843"
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Features
|
|
||||||
body: Adding the entity node
|
|
||||||
time: 2023-01-18T13:48:04.487817-06:00
|
|
||||||
custom:
|
|
||||||
Author: callum-mcdata
|
|
||||||
Issue: "6627"
|
|
||||||
8
.changes/unreleased/Fixes-20220823-112633.yaml
Normal file
8
.changes/unreleased/Fixes-20220823-112633.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Include py.typed in MANIFEST.in. This enables packages that install dbt-core
|
||||||
|
from pypi to use mypy.
|
||||||
|
time: 2022-08-23T11:26:33.8415455-07:00
|
||||||
|
custom:
|
||||||
|
Author: panasenco
|
||||||
|
Issue: "5703"
|
||||||
|
PR: "5703"
|
||||||
7
.changes/unreleased/Fixes-20220903-155409.yaml
Normal file
7
.changes/unreleased/Fixes-20220903-155409.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Removal of all .coverage files when using make clean command
|
||||||
|
time: 2022-09-03T15:54:09.741554082+01:00
|
||||||
|
custom:
|
||||||
|
Author: jared-rimmer
|
||||||
|
Issue: "5633"
|
||||||
|
PR: "5759"
|
||||||
7
.changes/unreleased/Fixes-20220909-092832.yaml
Normal file
7
.changes/unreleased/Fixes-20220909-092832.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Remove temp files generated by unit tests
|
||||||
|
time: 2022-09-09T09:28:32.590208+02:00
|
||||||
|
custom:
|
||||||
|
Author: bbroeksema
|
||||||
|
Issue: "5631"
|
||||||
|
PR: "5749"
|
||||||
7
.changes/unreleased/Fixes-20220909-095627.yaml
Normal file
7
.changes/unreleased/Fixes-20220909-095627.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixes
|
||||||
|
body: Fix warnings as errors during tests
|
||||||
|
time: 2022-09-09T09:56:27.90654-05:00
|
||||||
|
custom:
|
||||||
|
Author: stu-k
|
||||||
|
Issue: "5424"
|
||||||
|
PR: "5800"
|
||||||
7
.changes/unreleased/Under the Hood-20220905-001749.yaml
Normal file
7
.changes/unreleased/Under the Hood-20220905-001749.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Migrate integration test 014 but also fix the snapshot hard delete test's timezone logic and force all integration tests to run flags.set_from_args to force environment variables are accessible to all integration test threads.
|
||||||
|
time: 2022-09-05T00:17:49.564534-07:00
|
||||||
|
custom:
|
||||||
|
Author: versusfacit
|
||||||
|
Issue: "5760"
|
||||||
|
PR: "5760"
|
||||||
7
.changes/unreleased/Under the Hood-20220908-145644.yaml
Normal file
7
.changes/unreleased/Under the Hood-20220908-145644.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Support dbt-metrics compilation by rebuilding flat_graph
|
||||||
|
time: 2022-09-08T14:56:44.173322-04:00
|
||||||
|
custom:
|
||||||
|
Author: gshank
|
||||||
|
Issue: "5525"
|
||||||
|
PR: "5786"
|
||||||
8
.changes/unreleased/Under the Hood-20220908-180731.yaml
Normal file
8
.changes/unreleased/Under the Hood-20220908-180731.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Reworking the way we define the window attribute of metrics to match freshness
|
||||||
|
tests
|
||||||
|
time: 2022-09-08T18:07:31.532608-05:00
|
||||||
|
custom:
|
||||||
|
Author: callum-mcdata
|
||||||
|
Issue: "5722"
|
||||||
|
PR: "5793"
|
||||||
7
.changes/unreleased/Under the Hood-20220909-115220.yaml
Normal file
7
.changes/unreleased/Under the Hood-20220909-115220.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Add PythonJobHelper base class in core and add more type checking
|
||||||
|
time: 2022-09-09T11:52:20.419364-07:00
|
||||||
|
custom:
|
||||||
|
Author: ChenyuLInx
|
||||||
|
Issue: "5802"
|
||||||
|
PR: "5802"
|
||||||
7
.changes/unreleased/Under the Hood-20220912-134000.yaml
Normal file
7
.changes/unreleased/Under the Hood-20220912-134000.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: Convert default selector tests to pytest
|
||||||
|
time: 2022-09-12T13:40:00.625912-05:00
|
||||||
|
custom:
|
||||||
|
Author: stu-k
|
||||||
|
Issue: "5728"
|
||||||
|
PR: "5820"
|
||||||
7
.changes/unreleased/Under the Hood-20220912-140035.yaml
Normal file
7
.changes/unreleased/Under the Hood-20220912-140035.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
kind: Under the Hood
|
||||||
|
body: The link did not go to the anchor directly, now it does
|
||||||
|
time: 2022-09-12T14:00:35.899828+02:00
|
||||||
|
custom:
|
||||||
|
Author: sdebruyn
|
||||||
|
Issue: "5813"
|
||||||
|
PR: "5814"
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Under the Hood
|
|
||||||
body: Fix use of ConnectionReused logging event
|
|
||||||
time: 2023-01-13T13:25:13.023168-05:00
|
|
||||||
custom:
|
|
||||||
Author: gshank
|
|
||||||
Issue: "6168"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Under the Hood
|
|
||||||
body: Update deprecated github action command
|
|
||||||
time: 2023-01-17T11:17:37.046095-06:00
|
|
||||||
custom:
|
|
||||||
Author: davidbloss
|
|
||||||
Issue: "6153"
|
|
||||||
107
.changie.yaml
Normal file → Executable file
107
.changie.yaml
Normal file → Executable file
@@ -6,67 +6,19 @@ changelogPath: CHANGELOG.md
|
|||||||
versionExt: md
|
versionExt: md
|
||||||
versionFormat: '## dbt-core {{.Version}} - {{.Time.Format "January 02, 2006"}}'
|
versionFormat: '## dbt-core {{.Version}} - {{.Time.Format "January 02, 2006"}}'
|
||||||
kindFormat: '### {{.Kind}}'
|
kindFormat: '### {{.Kind}}'
|
||||||
changeFormat: |-
|
changeFormat: '- {{.Body}} ([#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-core/issues/{{.Custom.Issue}}), [#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-core/pull/{{.Custom.PR}}))'
|
||||||
{{- $IssueList := list }}
|
|
||||||
{{- $changes := splitList " " $.Custom.Issue }}
|
|
||||||
{{- range $issueNbr := $changes }}
|
|
||||||
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/issues/nbr)" | replace "nbr" $issueNbr }}
|
|
||||||
{{- $IssueList = append $IssueList $changeLink }}
|
|
||||||
{{- end -}}
|
|
||||||
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
|
|
||||||
kinds:
|
kinds:
|
||||||
- label: Breaking Changes
|
- label: Breaking Changes
|
||||||
- label: Features
|
- label: Features
|
||||||
- label: Fixes
|
- label: Fixes
|
||||||
- label: Docs
|
- label: Docs
|
||||||
changeFormat: |-
|
changeFormat: '- {{.Body}} ([dbt-docs/#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-docs/issues/{{.Custom.Issue}}), [dbt-docs/#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-docs/pull/{{.Custom.PR}}))'
|
||||||
{{- $IssueList := list }}
|
|
||||||
{{- $changes := splitList " " $.Custom.Issue }}
|
|
||||||
{{- range $issueNbr := $changes }}
|
|
||||||
{{- $changeLink := "[dbt-docs/#nbr](https://github.com/dbt-labs/dbt-docs/issues/nbr)" | replace "nbr" $issueNbr }}
|
|
||||||
{{- $IssueList = append $IssueList $changeLink }}
|
|
||||||
{{- end -}}
|
|
||||||
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
- label: Under the Hood
|
- label: Under the Hood
|
||||||
- label: Dependencies
|
- label: Dependencies
|
||||||
changeFormat: |-
|
changeFormat: '- {{.Body}} ({{if ne .Custom.Issue ""}}[#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-core/issues/{{.Custom.Issue}}), {{end}}[#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-core/pull/{{.Custom.PR}}))'
|
||||||
{{- $PRList := list }}
|
|
||||||
{{- $changes := splitList " " $.Custom.PR }}
|
|
||||||
{{- range $pullrequest := $changes }}
|
|
||||||
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/pull/nbr)" | replace "nbr" $pullrequest }}
|
|
||||||
{{- $PRList = append $PRList $changeLink }}
|
|
||||||
{{- end -}}
|
|
||||||
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
skipGlobalChoices: true
|
|
||||||
additionalChoices:
|
|
||||||
- key: Author
|
|
||||||
label: GitHub Username(s) (separated by a single space if multiple)
|
|
||||||
type: string
|
|
||||||
minLength: 3
|
|
||||||
- key: PR
|
|
||||||
label: GitHub Pull Request Number (separated by a single space if multiple)
|
|
||||||
type: string
|
|
||||||
minLength: 1
|
|
||||||
- label: Security
|
- label: Security
|
||||||
changeFormat: |-
|
changeFormat: '- {{.Body}} ({{if ne .Custom.Issue ""}}[#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-core/issues/{{.Custom.Issue}}), {{end}}[#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-core/pull/{{.Custom.PR}}))'
|
||||||
{{- $PRList := list }}
|
|
||||||
{{- $changes := splitList " " $.Custom.PR }}
|
|
||||||
{{- range $pullrequest := $changes }}
|
|
||||||
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/pull/nbr)" | replace "nbr" $pullrequest }}
|
|
||||||
{{- $PRList = append $PRList $changeLink }}
|
|
||||||
{{- end -}}
|
|
||||||
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
skipGlobalChoices: true
|
|
||||||
additionalChoices:
|
|
||||||
- key: Author
|
|
||||||
label: GitHub Username(s) (separated by a single space if multiple)
|
|
||||||
type: string
|
|
||||||
minLength: 3
|
|
||||||
- key: PR
|
|
||||||
label: GitHub Pull Request Number (separated by a single space if multiple)
|
|
||||||
type: string
|
|
||||||
minLength: 1
|
|
||||||
|
|
||||||
newlines:
|
newlines:
|
||||||
afterChangelogHeader: 1
|
afterChangelogHeader: 1
|
||||||
@@ -81,41 +33,42 @@ custom:
|
|||||||
type: string
|
type: string
|
||||||
minLength: 3
|
minLength: 3
|
||||||
- key: Issue
|
- key: Issue
|
||||||
label: GitHub Issue Number (separated by a single space if multiple)
|
label: GitHub Issue Number
|
||||||
type: string
|
type: int
|
||||||
minLength: 1
|
minInt: 1
|
||||||
|
- key: PR
|
||||||
|
label: GitHub Pull Request Number
|
||||||
|
type: int
|
||||||
|
minInt: 1
|
||||||
|
|
||||||
footerFormat: |
|
footerFormat: |
|
||||||
{{- $contributorDict := dict }}
|
{{- $contributorDict := dict }}
|
||||||
{{- /* any names added to this list should be all lowercase for later matching purposes */}}
|
{{- /* any names added to this list should be all lowercase for later matching purposes */}}
|
||||||
{{- $core_team := list "michelleark" "peterallenwebb" "emmyoop" "nathaniel-may" "gshank" "leahwicz" "chenyulinx" "stu-k" "iknox-fa" "versusfacit" "mcknight-42" "jtcohen6" "aranke" "dependabot[bot]" "snyk-bot" "colin-rogers-dbt" }}
|
{{- $core_team := list "emmyoop" "nathaniel-may" "gshank" "leahwicz" "chenyulinx" "stu-k" "iknox-fa" "versusfacit" "mcknight-42" "jtcohen6" "dependabot[bot]" "snyk-bot" }}
|
||||||
{{- range $change := .Changes }}
|
{{- range $change := .Changes }}
|
||||||
{{- $authorList := splitList " " $change.Custom.Author }}
|
{{- $authorList := splitList " " $change.Custom.Author }}
|
||||||
{{- /* loop through all authors for a single changelog */}}
|
{{- /* loop through all authors for a PR */}}
|
||||||
{{- range $author := $authorList }}
|
{{- range $author := $authorList }}
|
||||||
{{- $authorLower := lower $author }}
|
{{- $authorLower := lower $author }}
|
||||||
{{- /* we only want to include non-core team contributors */}}
|
{{- /* we only want to include non-core team contributors */}}
|
||||||
{{- if not (has $authorLower $core_team)}}
|
{{- if not (has $authorLower $core_team)}}
|
||||||
{{- $changeList := splitList " " $change.Custom.Author }}
|
{{- /* Docs kind link back to dbt-docs instead of dbt-core PRs */}}
|
||||||
{{- /* Docs kind link back to dbt-docs instead of dbt-core issues */}}
|
{{- $prLink := $change.Kind }}
|
||||||
{{- $changeLink := $change.Kind }}
|
{{- if eq $change.Kind "Docs" }}
|
||||||
{{- if or (eq $change.Kind "Dependencies") (eq $change.Kind "Security") }}
|
{{- $prLink = "[dbt-docs/#pr](https://github.com/dbt-labs/dbt-docs/pull/pr)" | replace "pr" $change.Custom.PR }}
|
||||||
{{- $changeLink = "[#nbr](https://github.com/dbt-labs/dbt-core/pull/nbr)" | replace "nbr" $change.Custom.PR }}
|
{{- else }}
|
||||||
{{- else if eq $change.Kind "Docs"}}
|
{{- $prLink = "[#pr](https://github.com/dbt-labs/dbt-core/pull/pr)" | replace "pr" $change.Custom.PR }}
|
||||||
{{- $changeLink = "[dbt-docs/#nbr](https://github.com/dbt-labs/dbt-docs/issues/nbr)" | replace "nbr" $change.Custom.Issue }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- /* check if this contributor has other PRs associated with them already */}}
|
||||||
{{- $changeLink = "[#nbr](https://github.com/dbt-labs/dbt-core/issues/nbr)" | replace "nbr" $change.Custom.Issue }}
|
{{- if hasKey $contributorDict $author }}
|
||||||
{{- end }}
|
{{- $prList := get $contributorDict $author }}
|
||||||
{{- /* check if this contributor has other changes associated with them already */}}
|
{{- $prList = append $prList $prLink }}
|
||||||
{{- if hasKey $contributorDict $author }}
|
{{- $contributorDict := set $contributorDict $author $prList }}
|
||||||
{{- $contributionList := get $contributorDict $author }}
|
{{- else }}
|
||||||
{{- $contributionList = append $contributionList $changeLink }}
|
{{- $prList := list $prLink }}
|
||||||
{{- $contributorDict := set $contributorDict $author $contributionList }}
|
{{- $contributorDict := set $contributorDict $author $prList }}
|
||||||
{{- else }}
|
{{- end }}
|
||||||
{{- $contributionList := list $changeLink }}
|
{{- end}}
|
||||||
{{- $contributorDict := set $contributorDict $author $contributionList }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
|
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
|
||||||
|
|||||||
2
.flake8
2
.flake8
@@ -9,4 +9,4 @@ ignore =
|
|||||||
E203 # makes Flake8 work like black
|
E203 # makes Flake8 work like black
|
||||||
E741
|
E741
|
||||||
E501 # long line checking is done in black
|
E501 # long line checking is done in black
|
||||||
exclude = test/
|
exclude = test
|
||||||
|
|||||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,2 +0,0 @@
|
|||||||
core/dbt/include/index.html binary
|
|
||||||
tests/functional/artifacts/data/state/*/manifest.json binary
|
|
||||||
20
.github/_README.md
vendored
20
.github/_README.md
vendored
@@ -63,12 +63,12 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
```
|
```
|
||||||
|
|
||||||
### Secrets
|
### Secrets
|
||||||
- When to use a [Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) vs the [GITHUB_TOKEN](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) generated for the action?
|
- When to use a [Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) vs the [GITHUB_TOKEN](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) generated for the action?
|
||||||
|
|
||||||
The `GITHUB_TOKEN` is used by default. In most cases it is sufficient for what you need.
|
The `GITHUB_TOKEN` is used by default. In most cases it is sufficient for what you need.
|
||||||
|
|
||||||
If you expect the workflow to result in a commit to that should retrigger workflows, you will need to use a Personal Access Token for the bot to commit the file. When using the GITHUB_TOKEN, the resulting commit will not trigger another GitHub Actions Workflow run. This is due to limitations set by GitHub. See [the docs](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow) for a more detailed explanation.
|
If you expect the workflow to result in a commit to that should retrigger workflows, you will need to use a Personal Access Token for the bot to commit the file. When using the GITHUB_TOKEN, the resulting commit will not trigger another GitHub Actions Workflow run. This is due to limitations set by GitHub. See [the docs](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow) for a more detailed explanation.
|
||||||
|
|
||||||
For example, we must use a PAT in our workflow to commit a new changelog yaml file for bot PRs. Once the file has been committed to the branch, it should retrigger the check to validate that a changelog exists on the PR. Otherwise, it would stay in a failed state since the check would never retrigger.
|
For example, we must use a PAT in our workflow to commit a new changelog yaml file for bot PRs. Once the file has been committed to the branch, it should retrigger the check to validate that a changelog exists on the PR. Otherwise, it would stay in a failed state since the check would never retrigger.
|
||||||
@@ -105,7 +105,7 @@ Some triggers of note that we use:
|
|||||||
|
|
||||||
```
|
```
|
||||||
# **what?**
|
# **what?**
|
||||||
# Describe what the action does.
|
# Describe what the action does.
|
||||||
|
|
||||||
# **why?**
|
# **why?**
|
||||||
# Why does this action exist?
|
# Why does this action exist?
|
||||||
@@ -138,7 +138,7 @@ Some triggers of note that we use:
|
|||||||
id: fp
|
id: fp
|
||||||
run: |
|
run: |
|
||||||
FILEPATH=.changes/unreleased/Dependencies-${{ steps.filename_time.outputs.time }}.yaml
|
FILEPATH=.changes/unreleased/Dependencies-${{ steps.filename_time.outputs.time }}.yaml
|
||||||
echo "FILEPATH=$FILEPATH" >> $GITHUB_OUTPUT
|
echo "::set-output name=FILEPATH::$FILEPATH"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Print out all variables you will reference as the first step of a job. This allows for easier debugging. The first job should log all inputs. Subsequent jobs should reference outputs of other jobs, if present.
|
- Print out all variables you will reference as the first step of a job. This allows for easier debugging. The first job should log all inputs. Subsequent jobs should reference outputs of other jobs, if present.
|
||||||
@@ -158,14 +158,14 @@ Some triggers of note that we use:
|
|||||||
echo "The build_script_path: ${{ inputs.build_script_path }}"
|
echo "The build_script_path: ${{ inputs.build_script_path }}"
|
||||||
echo "The s3_bucket_name: ${{ inputs.s3_bucket_name }}"
|
echo "The s3_bucket_name: ${{ inputs.s3_bucket_name }}"
|
||||||
echo "The package_test_command: ${{ inputs.package_test_command }}"
|
echo "The package_test_command: ${{ inputs.package_test_command }}"
|
||||||
|
|
||||||
# collect all the variables that need to be used in subsequent jobs
|
# collect all the variables that need to be used in subsequent jobs
|
||||||
- name: Set Variables
|
- name: Set Variables
|
||||||
id: variables
|
id: variables
|
||||||
run: |
|
run: |
|
||||||
echo "important_path='performance/runner/Cargo.toml'" >> $GITHUB_OUTPUT
|
echo "::set-output name=important_path::'performance/runner/Cargo.toml'"
|
||||||
echo "release_id=${{github.event.inputs.release_id}}" >> $GITHUB_OUTPUT
|
echo "::set-output name=release_id::${{github.event.inputs.release_id}}"
|
||||||
echo "open_prs=${{github.event.inputs.open_prs}}" >> $GITHUB_OUTPUT
|
echo "::set-output name=open_prs::${{github.event.inputs.open_prs}}"
|
||||||
|
|
||||||
job2:
|
job2:
|
||||||
needs: [job1]
|
needs: [job1]
|
||||||
@@ -190,7 +190,7 @@ ___
|
|||||||
### Actions from the Marketplace
|
### Actions from the Marketplace
|
||||||
- Don’t use external actions for things that can easily be accomplished manually.
|
- Don’t use external actions for things that can easily be accomplished manually.
|
||||||
- Always read through what an external action does before using it! Often an action in the GitHub Actions Marketplace can be replaced with a few lines in bash. This is much more maintainable (and won’t change under us) and clear as to what’s actually happening. It also prevents any
|
- Always read through what an external action does before using it! Often an action in the GitHub Actions Marketplace can be replaced with a few lines in bash. This is much more maintainable (and won’t change under us) and clear as to what’s actually happening. It also prevents any
|
||||||
- Pin actions _we don't control_ to tags.
|
- Pin actions _we don't control_ to tags.
|
||||||
|
|
||||||
### Connecting to AWS
|
### Connecting to AWS
|
||||||
- Authenticate with the aws managed workflow
|
- Authenticate with the aws managed workflow
|
||||||
@@ -208,7 +208,7 @@ ___
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Copy Artifacts from S3 via CLI
|
- name: Copy Artifacts from S3 via CLI
|
||||||
run: aws s3 cp ${{ env.s3_bucket }} . --recursive
|
run: aws s3 cp ${{ env.s3_bucket }} . --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|||||||
17
.github/actions/latest-wrangler/main.py
vendored
17
.github/actions/latest-wrangler/main.py
vendored
@@ -28,12 +28,11 @@ if __name__ == "__main__":
|
|||||||
if package_request.status_code == 404:
|
if package_request.status_code == 404:
|
||||||
if halt_on_missing:
|
if halt_on_missing:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
# everything is the latest if the package doesn't exist
|
else:
|
||||||
github_output = os.environ.get("GITHUB_OUTPUT")
|
# everything is the latest if the package doesn't exist
|
||||||
with open(github_output, "at", encoding="utf-8") as gh_output:
|
print(f"::set-output name=latest::{True}")
|
||||||
gh_output.write("latest=True")
|
print(f"::set-output name=minor_latest::{True}")
|
||||||
gh_output.write("minor_latest=True")
|
sys.exit(0)
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# TODO: verify package meta is "correct"
|
# TODO: verify package meta is "correct"
|
||||||
# https://github.com/dbt-labs/dbt-core/issues/4640
|
# https://github.com/dbt-labs/dbt-core/issues/4640
|
||||||
@@ -92,7 +91,5 @@ if __name__ == "__main__":
|
|||||||
latest = is_latest(pre_rel, new_version, current_latest)
|
latest = is_latest(pre_rel, new_version, current_latest)
|
||||||
minor_latest = is_latest(pre_rel, new_version, current_minor_latest)
|
minor_latest = is_latest(pre_rel, new_version, current_minor_latest)
|
||||||
|
|
||||||
github_output = os.environ.get("GITHUB_OUTPUT")
|
print(f"::set-output name=latest::{latest}")
|
||||||
with open(github_output, "at", encoding="utf-8") as gh_output:
|
print(f"::set-output name=minor_latest::{minor_latest}")
|
||||||
gh_output.write(f"latest={latest}")
|
|
||||||
gh_output.write(f"minor_latest={minor_latest}")
|
|
||||||
|
|||||||
4
.github/workflows/bot-changelog.yml
vendored
4
.github/workflows/bot-changelog.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- label: "dependencies"
|
- label: "dependencies"
|
||||||
changie_kind: "Dependencies"
|
changie_kind: "Dependency"
|
||||||
- label: "snyk"
|
- label: "snyk"
|
||||||
changie_kind: "Security"
|
changie_kind: "Security"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -58,4 +58,4 @@ jobs:
|
|||||||
commit_message: "Add automated changelog yaml from template for bot PR"
|
commit_message: "Add automated changelog yaml from template for bot PR"
|
||||||
changie_kind: ${{ matrix.changie_kind }}
|
changie_kind: ${{ matrix.changie_kind }}
|
||||||
label: ${{ matrix.label }}
|
label: ${{ matrix.label }}
|
||||||
custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n PR: ${{ github.event.pull_request.number }}"
|
custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n Issue: 4904\n PR: ${{ github.event.pull_request.number }}"
|
||||||
|
|||||||
165
.github/workflows/generate-cli-api-docs.yml
vendored
165
.github/workflows/generate-cli-api-docs.yml
vendored
@@ -1,165 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# On push, if anything in core/dbt/docs or core/dbt/cli has been
|
|
||||||
# created or modified, regenerate the CLI API docs using sphinx.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# We watch for changes in core/dbt/cli because the CLI API docs rely on click
|
|
||||||
# and all supporting flags/params to be generated. We watch for changes in
|
|
||||||
# core/dbt/docs since any changes to sphinx configuration or any of the
|
|
||||||
# .rst files there could result in a differently build final index.html file.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# Whenever a change has been pushed to a branch, and only if there is a diff
|
|
||||||
# between the PR branch and main's core/dbt/cli and or core/dbt/docs dirs.
|
|
||||||
|
|
||||||
# TODO: add bot comment to PR informing contributor that the docs have been committed
|
|
||||||
# TODO: figure out why github action triggered pushes cause github to fail to report
|
|
||||||
# the status of jobs
|
|
||||||
|
|
||||||
name: Generate CLI API docs
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
CLI_DIR: ${{ github.workspace }}/core/dbt/cli
|
|
||||||
DOCS_DIR: ${{ github.workspace }}/core/dbt/docs
|
|
||||||
DOCS_BUILD_DIR: ${{ github.workspace }}/core/dbt/docs/build
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check_gen:
|
|
||||||
name: check if generation needed
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ github.event.pull_request.head.repo.fork == false }}
|
|
||||||
outputs:
|
|
||||||
cli_dir_changed: ${{ steps.check_cli.outputs.cli_dir_changed }}
|
|
||||||
docs_dir_changed: ${{ steps.check_docs.outputs.docs_dir_changed }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "[DEBUG] print variables"
|
|
||||||
run: |
|
|
||||||
echo "env.CLI_DIR: ${{ env.CLI_DIR }}"
|
|
||||||
echo "env.DOCS_BUILD_DIR: ${{ env.DOCS_BUILD_DIR }}"
|
|
||||||
echo "env.DOCS_DIR: ${{ env.DOCS_DIR }}"
|
|
||||||
|
|
||||||
- name: git checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.head_ref }}
|
|
||||||
|
|
||||||
- name: set shas
|
|
||||||
id: set_shas
|
|
||||||
run: |
|
|
||||||
THIS_SHA=$(git rev-parse @)
|
|
||||||
LAST_SHA=$(git rev-parse @~1)
|
|
||||||
|
|
||||||
echo "this sha: $THIS_SHA"
|
|
||||||
echo "last sha: $LAST_SHA"
|
|
||||||
|
|
||||||
echo "this_sha=$THIS_SHA" >> $GITHUB_OUTPUT
|
|
||||||
echo "last_sha=$LAST_SHA" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: check for changes in core/dbt/cli
|
|
||||||
id: check_cli
|
|
||||||
run: |
|
|
||||||
CLI_DIR_CHANGES=$(git diff \
|
|
||||||
${{ steps.set_shas.outputs.last_sha }} \
|
|
||||||
${{ steps.set_shas.outputs.this_sha }} \
|
|
||||||
-- ${{ env.CLI_DIR }})
|
|
||||||
|
|
||||||
if [ -n "$CLI_DIR_CHANGES" ]; then
|
|
||||||
echo "changes found"
|
|
||||||
echo $CLI_DIR_CHANGES
|
|
||||||
echo "cli_dir_changed=true" >> $GITHUB_OUTPUT
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "cli_dir_changed=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "no changes found"
|
|
||||||
|
|
||||||
- name: check for changes in core/dbt/docs
|
|
||||||
id: check_docs
|
|
||||||
if: steps.check_cli.outputs.cli_dir_changed == 'false'
|
|
||||||
run: |
|
|
||||||
DOCS_DIR_CHANGES=$(git diff --name-only \
|
|
||||||
${{ steps.set_shas.outputs.last_sha }} \
|
|
||||||
${{ steps.set_shas.outputs.this_sha }} \
|
|
||||||
-- ${{ env.DOCS_DIR }} ':!${{ env.DOCS_BUILD_DIR }}')
|
|
||||||
|
|
||||||
DOCS_BUILD_DIR_CHANGES=$(git diff --name-only \
|
|
||||||
${{ steps.set_shas.outputs.last_sha }} \
|
|
||||||
${{ steps.set_shas.outputs.this_sha }} \
|
|
||||||
-- ${{ env.DOCS_BUILD_DIR }})
|
|
||||||
|
|
||||||
if [ -n "$DOCS_DIR_CHANGES" ] && [ -z "$DOCS_BUILD_DIR_CHANGES" ]; then
|
|
||||||
echo "changes found"
|
|
||||||
echo $DOCS_DIR_CHANGES
|
|
||||||
echo "docs_dir_changed=true" >> $GITHUB_OUTPUT
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "docs_dir_changed=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "no changes found"
|
|
||||||
|
|
||||||
gen_docs:
|
|
||||||
name: generate docs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [check_gen]
|
|
||||||
if: |
|
|
||||||
needs.check_gen.outputs.cli_dir_changed == 'true'
|
|
||||||
|| needs.check_gen.outputs.docs_dir_changed == 'true'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "[DEBUG] print variables"
|
|
||||||
run: |
|
|
||||||
echo "env.DOCS_DIR: ${{ env.DOCS_DIR }}"
|
|
||||||
echo "github head_ref: ${{ github.head_ref }}"
|
|
||||||
|
|
||||||
- name: git checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.head_ref }}
|
|
||||||
|
|
||||||
- name: install python
|
|
||||||
uses: actions/setup-python@v4.3.0
|
|
||||||
with:
|
|
||||||
python-version: 3.8
|
|
||||||
|
|
||||||
- name: install dev requirements
|
|
||||||
run: |
|
|
||||||
python3 -m venv env
|
|
||||||
source env/bin/activate
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt -r dev-requirements.txt
|
|
||||||
|
|
||||||
- name: generate docs
|
|
||||||
run: |
|
|
||||||
source env/bin/activate
|
|
||||||
cd ${{ env.DOCS_DIR }}
|
|
||||||
|
|
||||||
echo "cleaning existing docs"
|
|
||||||
make clean
|
|
||||||
|
|
||||||
echo "creating docs"
|
|
||||||
make html
|
|
||||||
|
|
||||||
- name: debug
|
|
||||||
run: |
|
|
||||||
echo ">>>>> status"
|
|
||||||
git status
|
|
||||||
echo ">>>>> remotes"
|
|
||||||
git remote -v
|
|
||||||
echo ">>>>> branch"
|
|
||||||
git branch -v
|
|
||||||
echo ">>>>> log"
|
|
||||||
git log --pretty=oneline | head -5
|
|
||||||
|
|
||||||
- name: commit docs
|
|
||||||
run: |
|
|
||||||
git config user.name 'Github Build Bot'
|
|
||||||
git config user.email 'buildbot@fishtownanalytics.com'
|
|
||||||
git commit -am "Add generated CLI API docs"
|
|
||||||
git push -u origin ${{ github.head_ref }}
|
|
||||||
3
.github/workflows/jira-transition.yml
vendored
3
.github/workflows/jira-transition.yml
vendored
@@ -15,9 +15,6 @@ on:
|
|||||||
issues:
|
issues:
|
||||||
types: [closed, deleted, reopened]
|
types: [closed, deleted, reopened]
|
||||||
|
|
||||||
# no special access is needed
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call-label-action:
|
call-label-action:
|
||||||
uses: dbt-labs/jira-actions/.github/workflows/jira-transition.yml@main
|
uses: dbt-labs/jira-actions/.github/workflows/jira-transition.yml@main
|
||||||
|
|||||||
26
.github/workflows/main.yml
vendored
26
.github/workflows/main.yml
vendored
@@ -45,9 +45,7 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4.3.0
|
uses: actions/setup-python@v2
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
|
|
||||||
- name: Install python dependencies
|
- name: Install python dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -73,7 +71,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TOXENV: "unit"
|
TOXENV: "unit"
|
||||||
@@ -84,7 +82,7 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4.3.0
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
@@ -101,9 +99,7 @@ jobs:
|
|||||||
- name: Get current date
|
- name: Get current date
|
||||||
if: always()
|
if: always()
|
||||||
id: date
|
id: date
|
||||||
run: |
|
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H_%M_%S')" #no colons allowed for artifacts
|
||||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H_%M_%S') # no colons allowed for artifacts
|
|
||||||
echo "date=$CURRENT_DATE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: always()
|
if: always()
|
||||||
@@ -120,8 +116,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||||
os: [ubuntu-20.04]
|
os: [ubuntu-latest]
|
||||||
include:
|
include:
|
||||||
- python-version: 3.8
|
- python-version: 3.8
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
@@ -141,7 +137,7 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4.3.0
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
@@ -170,9 +166,7 @@ jobs:
|
|||||||
- name: Get current date
|
- name: Get current date
|
||||||
if: always()
|
if: always()
|
||||||
id: date
|
id: date
|
||||||
run: |
|
run: echo "::set-output name=date::$(date +'%Y_%m_%dT%H_%M_%S')" #no colons allowed for artifacts
|
||||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H_%M_%S') # no colons allowed for artifacts
|
|
||||||
echo "date=$CURRENT_DATE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: always()
|
if: always()
|
||||||
@@ -196,9 +190,9 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4.3.0
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: '3.8'
|
python-version: 3.8
|
||||||
|
|
||||||
- name: Install python dependencies
|
- name: Install python dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/release-branch-tests.yml
vendored
2
.github/workflows/release-branch-tests.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
|||||||
max-parallel: 1
|
max-parallel: 1
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
branch: [1.0.latest, 1.1.latest, 1.2.latest, 1.3.latest, main]
|
branch: [1.0.latest, 1.1.latest, 1.2.latest, main]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Call CI workflow for ${{ matrix.branch }} branch
|
- name: Call CI workflow for ${{ matrix.branch }} branch
|
||||||
|
|||||||
12
.github/workflows/release-docker.yml
vendored
12
.github/workflows/release-docker.yml
vendored
@@ -41,9 +41,9 @@ jobs:
|
|||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
IFS="." read -r MAJOR MINOR PATCH <<< ${{ github.event.inputs.version_number }}
|
IFS="." read -r MAJOR MINOR PATCH <<< ${{ github.event.inputs.version_number }}
|
||||||
echo "major=$MAJOR" >> $GITHUB_OUTPUT
|
echo "::set-output name=major::$MAJOR"
|
||||||
echo "minor=$MINOR" >> $GITHUB_OUTPUT
|
echo "::set-output name=minor::$MINOR"
|
||||||
echo "patch=$PATCH" >> $GITHUB_OUTPUT
|
echo "::set-output name=patch::$PATCH"
|
||||||
|
|
||||||
- name: Is pkg 'latest'
|
- name: Is pkg 'latest'
|
||||||
id: latest
|
id: latest
|
||||||
@@ -70,10 +70,8 @@ jobs:
|
|||||||
- name: Get docker build arg
|
- name: Get docker build arg
|
||||||
id: build_arg
|
id: build_arg
|
||||||
run: |
|
run: |
|
||||||
BUILD_ARG_NAME=$(echo ${{ github.event.inputs.package }} | sed 's/\-/_/g')
|
echo "::set-output name=build_arg_name::"$(echo ${{ github.event.inputs.package }} | sed 's/\-/_/g')
|
||||||
BUILD_ARG_VALUE=$(echo ${{ github.event.inputs.package }} | sed 's/postgres/core/g')
|
echo "::set-output name=build_arg_value::"$(echo ${{ github.event.inputs.package }} | sed 's/postgres/core/g')
|
||||||
echo "build_arg_name=$BUILD_ARG_NAME" >> $GITHUB_OUTPUT
|
|
||||||
echo "build_arg_value=$BUILD_ARG_VALUE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Log in to the GHCR
|
- name: Log in to the GHCR
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
|
|||||||
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -20,9 +20,6 @@ on:
|
|||||||
description: 'The release version number (i.e. 1.0.0b1)'
|
description: 'The release version number (i.e. 1.0.0b1)'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write # this is the permission that allows creating a new release
|
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -165,7 +162,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
IS_PRERELEASE: ${{ contains(github.event.inputs.version_number, 'rc') || contains(github.event.inputs.version_number, 'b') }}
|
IS_PRERELEASE: ${{ contains(github.event.inputs.version_number, 'rc') || contains(github.event.inputs.version_number, 'b') }}
|
||||||
run: |
|
run: |
|
||||||
echo "isPrerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
|
echo ::set-output name=isPrerelease::$IS_PRERELEASE
|
||||||
|
|
||||||
- name: Creating GitHub Release
|
- name: Creating GitHub Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
3
.github/workflows/schema-check.yml
vendored
3
.github/workflows/schema-check.yml
vendored
@@ -21,9 +21,6 @@ on:
|
|||||||
- "*.latest"
|
- "*.latest"
|
||||||
- "releases/*"
|
- "releases/*"
|
||||||
|
|
||||||
# no special access is needed
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
LATEST_SCHEMA_PATH: ${{ github.workspace }}/new_schemas
|
LATEST_SCHEMA_PATH: ${{ github.workspace }}/new_schemas
|
||||||
SCHEMA_DIFF_ARTIFACT: ${{ github.workspace }}//schema_schanges.txt
|
SCHEMA_DIFF_ARTIFACT: ${{ github.workspace }}//schema_schanges.txt
|
||||||
|
|||||||
15
.github/workflows/stale.yml
vendored
15
.github/workflows/stale.yml
vendored
@@ -3,10 +3,15 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "30 1 * * *"
|
- cron: "30 1 * * *"
|
||||||
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
uses: dbt-labs/actions/.github/workflows/stale-bot-matrix.yml@main
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# pinned at v4 (https://github.com/actions/stale/releases/tag/v4.0.0)
|
||||||
|
- uses: actions/stale@cdf15f641adb27a71842045a94023bef6945e3aa
|
||||||
|
with:
|
||||||
|
stale-issue-message: "This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days."
|
||||||
|
stale-pr-message: "This PR has been marked as Stale because it has been open for 180 days with no activity. If you would like the PR to remain open, please remove the stale label or comment on the PR, or it will be closed in 7 days."
|
||||||
|
close-issue-message: "Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers."
|
||||||
|
# mark issues/PRs stale when they haven't seen activity in 180 days
|
||||||
|
days-before-stale: 180
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
# run the performance measurements on the current or default branch
|
# run the performance measurements on the current or default branch
|
||||||
test-schema:
|
test-schema:
|
||||||
name: Test Log Schema
|
name: Test Log Schema
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
# turns warnings into errors
|
# turns warnings into errors
|
||||||
RUSTFLAGS: "-D warnings"
|
RUSTFLAGS: "-D warnings"
|
||||||
@@ -46,6 +46,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.8"
|
python-version: "3.8"
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
- name: Install python dependencies
|
- name: Install python dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install --user --upgrade pip
|
pip install --user --upgrade pip
|
||||||
@@ -63,3 +69,10 @@ jobs:
|
|||||||
# we actually care if these pass, because the normal test run doesn't usually include many json log outputs
|
# we actually care if these pass, because the normal test run doesn't usually include many json log outputs
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: tox -e integration -- -nauto
|
run: tox -e integration -- -nauto
|
||||||
|
|
||||||
|
# apply our schema tests to every log event from the previous step
|
||||||
|
# skips any output that isn't valid json
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: run
|
||||||
|
args: --manifest-path test/interop/log_parsing/Cargo.toml
|
||||||
|
|||||||
40
.github/workflows/version-bump.yml
vendored
40
.github/workflows/version-bump.yml
vendored
@@ -20,10 +20,6 @@ on:
|
|||||||
description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)'
|
description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump:
|
bump:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -46,16 +42,6 @@ jobs:
|
|||||||
source env/bin/activate
|
source env/bin/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
|
|
||||||
- name: Add Homebrew to PATH
|
|
||||||
run: |
|
|
||||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Install Homebrew packages
|
|
||||||
run: |
|
|
||||||
brew install pre-commit
|
|
||||||
brew tap miniscruff/changie https://github.com/miniscruff/changie
|
|
||||||
brew install changie
|
|
||||||
|
|
||||||
- name: Audit Version and Parse Into Parts
|
- name: Audit Version and Parse Into Parts
|
||||||
id: semver
|
id: semver
|
||||||
uses: dbt-labs/actions/parse-semver@v1
|
uses: dbt-labs/actions/parse-semver@v1
|
||||||
@@ -65,7 +51,7 @@ jobs:
|
|||||||
- name: Set branch value
|
- name: Set branch value
|
||||||
id: variables
|
id: variables
|
||||||
run: |
|
run: |
|
||||||
echo "BRANCH_NAME=prep-release/${{ github.event.inputs.version_number }}_$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
|
echo "::set-output name=BRANCH_NAME::prep-release/${{ github.event.inputs.version_number }}_$GITHUB_RUN_ID"
|
||||||
|
|
||||||
- name: Create PR branch
|
- name: Create PR branch
|
||||||
run: |
|
run: |
|
||||||
@@ -80,8 +66,18 @@ jobs:
|
|||||||
env/bin/bumpversion --allow-dirty --new-version ${{ github.event.inputs.version_number }} major
|
env/bin/bumpversion --allow-dirty --new-version ${{ github.event.inputs.version_number }} major
|
||||||
git status
|
git status
|
||||||
|
|
||||||
|
# this step will fail on whitespace errors but also correct them
|
||||||
|
- name: Format bumpversion file
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
brew install pre-commit
|
||||||
|
pre-commit run trailing-whitespace --files .bumpversion.cfg
|
||||||
|
git status
|
||||||
|
|
||||||
- name: Run changie
|
- name: Run changie
|
||||||
run: |
|
run: |
|
||||||
|
brew tap miniscruff/changie https://github.com/miniscruff/changie
|
||||||
|
brew install changie
|
||||||
if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]]
|
if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]]
|
||||||
then
|
then
|
||||||
changie batch ${{ steps.semver.outputs.base-version }} --move-dir '${{ steps.semver.outputs.base-version }}' --prerelease '${{ steps.semver.outputs.pre-release }}'
|
changie batch ${{ steps.semver.outputs.base-version }} --move-dir '${{ steps.semver.outputs.base-version }}' --prerelease '${{ steps.semver.outputs.pre-release }}'
|
||||||
@@ -91,20 +87,6 @@ jobs:
|
|||||||
changie merge
|
changie merge
|
||||||
git status
|
git status
|
||||||
|
|
||||||
# this step will fail on whitespace errors but also correct them
|
|
||||||
- name: Remove trailing whitespace
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
pre-commit run trailing-whitespace --files .bumpversion.cfg CHANGELOG.md .changes/*
|
|
||||||
git status
|
|
||||||
|
|
||||||
# this step will fail on newline errors but also correct them
|
|
||||||
- name: Removing extra newlines
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
pre-commit run end-of-file-fixer --files .bumpversion.cfg CHANGELOG.md .changes/*
|
|
||||||
git status
|
|
||||||
|
|
||||||
- name: Commit version bump to branch
|
- name: Commit version bump to branch
|
||||||
uses: EndBug/add-and-commit@v7
|
uses: EndBug/add-and-commit@v7
|
||||||
with:
|
with:
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -11,7 +11,6 @@ __pycache__/
|
|||||||
env*/
|
env*/
|
||||||
dbt_env/
|
dbt_env/
|
||||||
build/
|
build/
|
||||||
!core/dbt/docs/build
|
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
dist/
|
||||||
downloads/
|
downloads/
|
||||||
@@ -25,8 +24,7 @@ var/
|
|||||||
*.egg-info/
|
*.egg-info/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
.mypy_cache/
|
*.mypy_cache/
|
||||||
.dmypy.json
|
|
||||||
logs/
|
logs/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
@@ -97,7 +95,7 @@ venv/
|
|||||||
|
|
||||||
# vscode
|
# vscode
|
||||||
.vscode/
|
.vscode/
|
||||||
*.code-workspace
|
|
||||||
|
|
||||||
# poetry
|
# poetry
|
||||||
|
pyproject.toml
|
||||||
poetry.lock
|
poetry.lock
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
# Eventually the hooks described here will be run as tests before merging each PR.
|
# Eventually the hooks described here will be run as tests before merging each PR.
|
||||||
|
|
||||||
# TODO: remove global exclusion of tests when testing overhaul is complete
|
# TODO: remove global exclusion of tests when testing overhaul is complete
|
||||||
exclude: ^(test/|core/dbt/docs/build/)
|
exclude: ^test/
|
||||||
|
|
||||||
# Force all unspecified python hooks to run python 3.8
|
# Force all unspecified python hooks to run python 3.8
|
||||||
default_language_version:
|
default_language_version:
|
||||||
python: python3
|
python: python3.8
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
@@ -24,13 +24,18 @@ repos:
|
|||||||
rev: 22.3.0
|
rev: 22.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
args:
|
||||||
|
- "--line-length=99"
|
||||||
|
- "--target-version=py38"
|
||||||
- id: black
|
- id: black
|
||||||
alias: black-check
|
alias: black-check
|
||||||
stages: [manual]
|
stages: [manual]
|
||||||
args:
|
args:
|
||||||
|
- "--line-length=99"
|
||||||
|
- "--target-version=py38"
|
||||||
- "--check"
|
- "--check"
|
||||||
- "--diff"
|
- "--diff"
|
||||||
- repo: https://github.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 4.0.1
|
rev: 4.0.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
|
|||||||
92
CHANGELOG.md
92
CHANGELOG.md
@@ -5,13 +5,101 @@
|
|||||||
- "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version.
|
- "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)
|
- 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.3.0-b2 - August 29, 2022
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Add `--defer` flag to dbt compile & dbt docs generate ([#4110](https://github.com/dbt-labs/dbt-core/issues/4110), [#4514](https://github.com/dbt-labs/dbt-core/pull/4514))
|
||||||
|
- use MethodName.File when value ends with .csv ([#5578](https://github.com/dbt-labs/dbt-core/issues/5578), [#5581](https://github.com/dbt-labs/dbt-core/pull/5581))
|
||||||
|
- Make `docs` configurable in `dbt_project.yml` and add a `node_color` attribute to change the color of nodes in the DAG ([#5333](https://github.com/dbt-labs/dbt-core/issues/5333), [#5397](https://github.com/dbt-labs/dbt-core/pull/5397))
|
||||||
|
- Adding ResolvedMetricReference helper functions and tests ([#5567](https://github.com/dbt-labs/dbt-core/issues/5567), [#5607](https://github.com/dbt-labs/dbt-core/pull/5607))
|
||||||
|
- Check dbt-core version requirements when installing Hub packages ([#5648](https://github.com/dbt-labs/dbt-core/issues/5648), [#5651](https://github.com/dbt-labs/dbt-core/pull/5651))
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- Remove the default 256 characters limit on postgres character varying type when no limitation is set ([#5238](https://github.com/dbt-labs/dbt-core/issues/5238), [#5292](https://github.com/dbt-labs/dbt-core/pull/5292))
|
||||||
|
- Include schema file config in unrendered_config ([#5338](https://github.com/dbt-labs/dbt-core/issues/5338), [#5344](https://github.com/dbt-labs/dbt-core/pull/5344))
|
||||||
|
- Resolves #5351 - Do not consider shorter varchar cols as schema changes ([#5351](https://github.com/dbt-labs/dbt-core/issues/5351), [#5395](https://github.com/dbt-labs/dbt-core/pull/5395))
|
||||||
|
- on_shchma_change fail verbosity enhancement ([#5504](https://github.com/dbt-labs/dbt-core/issues/5504), [#5505](https://github.com/dbt-labs/dbt-core/pull/5505))
|
||||||
|
- Fix error rendering docs block in metrics description ([#5585](https://github.com/dbt-labs/dbt-core/issues/5585), [#5603](https://github.com/dbt-labs/dbt-core/pull/5603))
|
||||||
|
- Extended validations for the project names ([#5379](https://github.com/dbt-labs/dbt-core/issues/5379), [#5620](https://github.com/dbt-labs/dbt-core/pull/5620))
|
||||||
|
- Use sys.exit instead of exit ([#5621](https://github.com/dbt-labs/dbt-core/issues/5621), [#5627](https://github.com/dbt-labs/dbt-core/pull/5627))
|
||||||
|
- Finishing logic upgrade to Redshift for name truncation collisions. ([#5586](https://github.com/dbt-labs/dbt-core/issues/5586), [#5656](https://github.com/dbt-labs/dbt-core/pull/5656))
|
||||||
|
- multiple args for ref and source ([#5634](https://github.com/dbt-labs/dbt-core/issues/5634), [#5635](https://github.com/dbt-labs/dbt-core/pull/5635))
|
||||||
|
- Fix Unexpected behavior when chaining methods on dbt-ref'ed/sourced dataframes ([#5646](https://github.com/dbt-labs/dbt-core/issues/5646), [#5677](https://github.com/dbt-labs/dbt-core/pull/5677))
|
||||||
|
|
||||||
|
### Docs
|
||||||
|
|
||||||
|
- Leverages `docs.node_color` from `dbt-core` to color nodes in the DAG ([dbt-docs/#44](https://github.com/dbt-labs/dbt-docs/issues/44), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
|
||||||
|
### Under the Hood
|
||||||
|
|
||||||
|
- Save use of default env vars to manifest to enable partial parsing in those cases. ([#5155](https://github.com/dbt-labs/dbt-core/issues/5155), [#5589](https://github.com/dbt-labs/dbt-core/pull/5589))
|
||||||
|
- add more information to log line interop test failures ([#5658](https://github.com/dbt-labs/dbt-core/issues/5658), [#5659](https://github.com/dbt-labs/dbt-core/pull/5659))
|
||||||
|
- Add supported languages to materializations ([#5569](https://github.com/dbt-labs/dbt-core/issues/5569), [#5695](https://github.com/dbt-labs/dbt-core/pull/5695))
|
||||||
|
|
||||||
|
### Dependency
|
||||||
|
|
||||||
|
- Bump python from 3.10.5-slim-bullseye to 3.10.6-slim-bullseye in /docker ([#4904](https://github.com/dbt-labs/dbt-core/issues/4904), [#5623](https://github.com/dbt-labs/dbt-core/pull/5623))
|
||||||
|
- Bump mashumaro[msgpack] from 3.0.3 to 3.0.4 in /core ([#4904](https://github.com/dbt-labs/dbt-core/issues/4904), [#5649](https://github.com/dbt-labs/dbt-core/pull/5649))
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
- [@Goodkat](https://github.com/Goodkat) ([#5581](https://github.com/dbt-labs/dbt-core/pull/5581), [#5620](https://github.com/dbt-labs/dbt-core/pull/5620))
|
||||||
|
- [@Ilanbenb](https://github.com/Ilanbenb) ([#5505](https://github.com/dbt-labs/dbt-core/pull/5505))
|
||||||
|
- [@b-per](https://github.com/b-per) ([#5397](https://github.com/dbt-labs/dbt-core/pull/5397), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
- [@callum-mcdata](https://github.com/callum-mcdata) ([#5607](https://github.com/dbt-labs/dbt-core/pull/5607))
|
||||||
|
- [@epapineau](https://github.com/epapineau) ([#5395](https://github.com/dbt-labs/dbt-core/pull/5395))
|
||||||
|
- [@kadero](https://github.com/kadero) ([#4514](https://github.com/dbt-labs/dbt-core/pull/4514))
|
||||||
|
- [@matt-winkler](https://github.com/matt-winkler) ([#5397](https://github.com/dbt-labs/dbt-core/pull/5397), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
- [@shrodingers](https://github.com/shrodingers) ([#5292](https://github.com/dbt-labs/dbt-core/pull/5292))
|
||||||
|
- [@sungchun12](https://github.com/sungchun12) ([#5397](https://github.com/dbt-labs/dbt-core/pull/5397), [dbt-docs/#281](https://github.com/dbt-labs/dbt-docs/pull/281))
|
||||||
|
- [@varun-dc](https://github.com/varun-dc) ([#5627](https://github.com/dbt-labs/dbt-core/pull/5627))
|
||||||
|
|
||||||
|
|
||||||
|
## dbt-core 1.3.0-b1 - July 29, 2022
|
||||||
|
### Features
|
||||||
|
- Python model inital version ([#5261](https://github.com/dbt-labs/dbt-core/issues/5261), [#5421](https://github.com/dbt-labs/dbt-core/pull/5421))
|
||||||
|
- allows user to include the file extension for .py models in the dbt run -m command. ([#5289](https://github.com/dbt-labs/dbt-core/issues/5289), [#5295](https://github.com/dbt-labs/dbt-core/pull/5295))
|
||||||
|
- Incremental materialization refactor and cleanup ([#5245](https://github.com/dbt-labs/dbt-core/issues/5245), [#5359](https://github.com/dbt-labs/dbt-core/pull/5359))
|
||||||
|
- Python models can support incremental logic ([#0](https://github.com/dbt-labs/dbt-core/issues/0), [#35](https://github.com/dbt-labs/dbt-core/pull/35))
|
||||||
|
- Add reusable function for retrying adapter connections. Utilize said function to add retries for Postgres (and Redshift). ([#5022](https://github.com/dbt-labs/dbt-core/issues/5022), [#5432](https://github.com/dbt-labs/dbt-core/pull/5432))
|
||||||
|
- add exponential backoff to connection retries on Postgres (and Redshift) ([#5502](https://github.com/dbt-labs/dbt-core/issues/5502), [#5503](https://github.com/dbt-labs/dbt-core/pull/5503))
|
||||||
|
### Fixes
|
||||||
|
- Add context to compilation errors generated while rendering generic test configuration values. ([#5294](https://github.com/dbt-labs/dbt-core/issues/5294), [#5393](https://github.com/dbt-labs/dbt-core/pull/5393))
|
||||||
|
- Rename try to strict for more intuitiveness ([#5475](https://github.com/dbt-labs/dbt-core/issues/5475), [#5477](https://github.com/dbt-labs/dbt-core/pull/5477))
|
||||||
|
- Ignore empty strings passed in as secrets ([#5312](https://github.com/dbt-labs/dbt-core/issues/5312), [#5518](https://github.com/dbt-labs/dbt-core/pull/5518))
|
||||||
|
- Fix handling of top-level exceptions ([#5564](https://github.com/dbt-labs/dbt-core/issues/5564), [#5560](https://github.com/dbt-labs/dbt-core/pull/5560))
|
||||||
|
### Docs
|
||||||
|
- Update dependency inline-source from ^6.1.5 to ^7.2.0 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency jest from ^26.2.2 to ^28.1.3 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency underscore from ^1.9.0 to ^1.13.4 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency webpack-cli from ^3.3.12 to ^4.7.0 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Update dependency webpack-dev-server from ^3.1.11 to ^4.9.3 ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Searches no longer require perfect matches, and instead consider each word individually. `my model` or `model my` will now find `my_model`, without the need for underscores ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- Support the renaming of SQL to code happening in dbt-core ([#5574](https://github.com/dbt-labs/dbt-core/issues/5574), [#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
### Under the Hood
|
||||||
|
- Added language to tracked fields in run_model event ([#5571](https://github.com/dbt-labs/dbt-core/issues/5571), [#5469](https://github.com/dbt-labs/dbt-core/pull/5469))
|
||||||
|
- Update mashumaro to 3.0.3 ([#4940](https://github.com/dbt-labs/dbt-core/issues/4940), [#5118](https://github.com/dbt-labs/dbt-core/pull/5118))
|
||||||
|
- Add python incremental materialization test ([#0000](https://github.com/dbt-labs/dbt-core/issues/0000), [#5571](https://github.com/dbt-labs/dbt-core/pull/5571))
|
||||||
|
### Dependencies
|
||||||
|
- Upgrade to Jinja2==3.1.2 from Jinja2==2.11.3 ([#4748](https://github.com/dbt-labs/dbt-core/issues/4748), [#5465](https://github.com/dbt-labs/dbt-core/pull/5465))
|
||||||
|
- Bump mypy from 0.961 to 0.971 ([#4904](https://github.com/dbt-labs/dbt-core/issues/4904), [#5495](https://github.com/dbt-labs/dbt-core/pull/5495))
|
||||||
|
- Remove pin for MarkUpSafe from >=0.23,<2.1 ([#5506](https://github.com/dbt-labs/dbt-core/issues/5506), [#5507](https://github.com/dbt-labs/dbt-core/pull/5507))
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
- [@Goodkat](https://github.com/Goodkat) ([#5518](https://github.com/dbt-labs/dbt-core/pull/5518))
|
||||||
|
- [@drewbanin](https://github.com/drewbanin) ([#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- [@jeremyyeo](https://github.com/jeremyyeo) ([#5477](https://github.com/dbt-labs/dbt-core/pull/5477))
|
||||||
|
- [@joellabes](https://github.com/joellabes) ([#5577](https://github.com/dbt-labs/dbt-core/pull/5577))
|
||||||
|
- [@leoebfolsom](https://github.com/leoebfolsom) ([#5295](https://github.com/dbt-labs/dbt-core/pull/5295))
|
||||||
|
- [@nicholasyager](https://github.com/nicholasyager) ([#5393](https://github.com/dbt-labs/dbt-core/pull/5393))
|
||||||
|
- [@tomasfarias](https://github.com/tomasfarias) ([#5432](https://github.com/dbt-labs/dbt-core/pull/5432))
|
||||||
|
|
||||||
## Previous Releases
|
## Previous Releases
|
||||||
|
|
||||||
For information on prior major and minor releases, see their changelogs:
|
For information on prior major and minor releases, see their changelogs:
|
||||||
|
|
||||||
|
|
||||||
* [1.4](https://github.com/dbt-labs/dbt-core/blob/1.4.latest/CHANGELOG.md)
|
|
||||||
* [1.3](https://github.com/dbt-labs/dbt-core/blob/1.3.latest/CHANGELOG.md)
|
|
||||||
* [1.2](https://github.com/dbt-labs/dbt-core/blob/1.2.latest/CHANGELOG.md)
|
* [1.2](https://github.com/dbt-labs/dbt-core/blob/1.2.latest/CHANGELOG.md)
|
||||||
* [1.1](https://github.com/dbt-labs/dbt-core/blob/1.1.latest/CHANGELOG.md)
|
* [1.1](https://github.com/dbt-labs/dbt-core/blob/1.1.latest/CHANGELOG.md)
|
||||||
* [1.0](https://github.com/dbt-labs/dbt-core/blob/1.0.latest/CHANGELOG.md)
|
* [1.0](https://github.com/dbt-labs/dbt-core/blob/1.0.latest/CHANGELOG.md)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ There are some tools that will be helpful to you in developing locally. While th
|
|||||||
|
|
||||||
These are the tools used in `dbt-core` development and testing:
|
These are the tools used in `dbt-core` development and testing:
|
||||||
|
|
||||||
- [`tox`](https://tox.readthedocs.io/en/latest/) to manage virtualenvs across python versions. We currently target the latest patch releases for Python 3.7, 3.8, 3.9, 3.10 and 3.11
|
- [`tox`](https://tox.readthedocs.io/en/latest/) to manage virtualenvs across python versions. We currently target the latest patch releases for Python 3.7, 3.8, 3.9, and 3.10
|
||||||
- [`pytest`](https://docs.pytest.org/en/latest/) to define, discover, and run tests
|
- [`pytest`](https://docs.pytest.org/en/latest/) to define, discover, and run tests
|
||||||
- [`flake8`](https://flake8.pycqa.org/en/latest/) for code linting
|
- [`flake8`](https://flake8.pycqa.org/en/latest/) for code linting
|
||||||
- [`black`](https://github.com/psf/black) for code formatting
|
- [`black`](https://github.com/psf/black) for code formatting
|
||||||
@@ -96,15 +96,12 @@ brew install postgresql
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
First make sure that you set up your `virtualenv` as described in [Setting up an environment](#setting-up-an-environment). Also ensure you have the latest version of pip installed with `pip install --upgrade pip`. Next, install `dbt-core` (and its dependencies):
|
First make sure that you set up your `virtualenv` as described in [Setting up an environment](#setting-up-an-environment). Also ensure you have the latest version of pip installed with `pip install --upgrade pip`. Next, install `dbt-core` (and its dependencies) with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make dev
|
make dev
|
||||||
```
|
# or
|
||||||
or, alternatively:
|
|
||||||
```sh
|
|
||||||
pip install -r dev-requirements.txt -r editable-requirements.txt
|
pip install -r dev-requirements.txt -r editable-requirements.txt
|
||||||
pre-commit install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
When installed in this way, any changes you make to your local copy of the source code will be reflected immediately in your next `dbt` run.
|
When installed in this way, any changes you make to your local copy of the source code will be reflected immediately in your next `dbt` run.
|
||||||
@@ -163,7 +160,7 @@ suites.
|
|||||||
|
|
||||||
#### `tox`
|
#### `tox`
|
||||||
|
|
||||||
[`tox`](https://tox.readthedocs.io/en/latest/) takes care of managing virtualenvs and install dependencies in order to run tests. You can also run tests in parallel, for example, you can run unit tests for Python 3.7, Python 3.8, Python 3.9, Python 3.10 and Python 3.11 checks in parallel with `tox -p`. Also, you can run unit tests for specific python versions with `tox -e py37`. The configuration for these tests in located in `tox.ini`.
|
[`tox`](https://tox.readthedocs.io/en/latest/) takes care of managing virtualenvs and install dependencies in order to run tests. You can also run tests in parallel, for example, you can run unit tests for Python 3.7, Python 3.8, Python 3.9, and Python 3.10 checks in parallel with `tox -p`. Also, you can run unit tests for specific python versions with `tox -e py37`. The configuration for these tests in located in `tox.ini`.
|
||||||
|
|
||||||
#### `pytest`
|
#### `pytest`
|
||||||
|
|
||||||
@@ -204,21 +201,13 @@ Here are some general rules for adding tests:
|
|||||||
* Sometimes flake8 complains about lines that are actually fine, in which case you can put a comment on the line such as: # noqa or # noqa: ANNN, where ANNN is the error code that flake8 issues.
|
* Sometimes flake8 complains about lines that are actually fine, in which case you can put a comment on the line such as: # noqa or # noqa: ANNN, where ANNN is the error code that flake8 issues.
|
||||||
* To collect output for `CProfile`, run dbt with the `-r` option and the name of an output file, i.e. `dbt -r dbt.cprof run`. If you just want to profile parsing, you can do: `dbt -r dbt.cprof parse`. `pip` install `snakeviz` to view the output. Run `snakeviz dbt.cprof` and output will be rendered in a browser window.
|
* To collect output for `CProfile`, run dbt with the `-r` option and the name of an output file, i.e. `dbt -r dbt.cprof run`. If you just want to profile parsing, you can do: `dbt -r dbt.cprof parse`. `pip` install `snakeviz` to view the output. Run `snakeviz dbt.cprof` and output will be rendered in a browser window.
|
||||||
|
|
||||||
## Adding or modifying a CHANGELOG Entry
|
## Adding a CHANGELOG Entry
|
||||||
|
|
||||||
We use [changie](https://changie.dev) to generate `CHANGELOG` entries. **Note:** Do not edit the `CHANGELOG.md` directly. Your modifications will be lost.
|
We use [changie](https://changie.dev) to generate `CHANGELOG` entries. **Note:** Do not edit the `CHANGELOG.md` directly. Your modifications will be lost.
|
||||||
|
|
||||||
Follow the steps to [install `changie`](https://changie.dev/guide/installation/) for your system.
|
Follow the steps to [install `changie`](https://changie.dev/guide/installation/) for your system.
|
||||||
|
|
||||||
Once changie is installed and your PR is created for a new feature, simply run the following command and changie will walk you through the process of creating a changelog entry:
|
Once changie is installed and your PR is created, simply run `changie new` and changie will walk you through the process of creating a changelog entry. Commit the file that's created and your changelog entry is complete!
|
||||||
|
|
||||||
```shell
|
|
||||||
changie new
|
|
||||||
```
|
|
||||||
|
|
||||||
Commit the file that's created and your changelog entry is complete!
|
|
||||||
|
|
||||||
If you are contributing to a feature already in progress, you will modify the changie yaml file in dbt/.changes/unreleased/ related to your change. If you need help finding this file, please ask within the discussion for the pull request!
|
|
||||||
|
|
||||||
You don't need to worry about which `dbt-core` version your change will go into. Just create the changelog entry with `changie`, and open your PR against the `main` branch. All merged changes will be included in the next minor version of `dbt-core`. The Core maintainers _may_ choose to "backport" specific changes in order to patch older minor versions. In that case, a maintainer will take care of that backport after merging your PR, before releasing the new version of `dbt-core`.
|
You don't need to worry about which `dbt-core` version your change will go into. Just create the changelog entry with `changie`, and open your PR against the `main` branch. All merged changes will be included in the next minor version of `dbt-core`. The Core maintainers _may_ choose to "backport" specific changes in order to patch older minor versions. In that case, a maintainer will take care of that backport after merging your PR, before releasing the new version of `dbt-core`.
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ RUN apt-get update \
|
|||||||
python3.10 \
|
python3.10 \
|
||||||
python3.10-dev \
|
python3.10-dev \
|
||||||
python3.10-venv \
|
python3.10-venv \
|
||||||
python3.11 \
|
|
||||||
python3.11-dev \
|
|
||||||
python3.11-venv \
|
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
|||||||
9
Makefile
9
Makefile
@@ -19,16 +19,11 @@ CI_FLAGS =\
|
|||||||
LOG_DIR=./logs\
|
LOG_DIR=./logs\
|
||||||
DBT_LOG_FORMAT=json
|
DBT_LOG_FORMAT=json
|
||||||
|
|
||||||
.PHONY: dev_req
|
.PHONY: dev
|
||||||
dev_req: ## Installs dbt-* packages in develop mode along with only development dependencies.
|
dev: ## Installs dbt-* packages in develop mode along with development dependencies.
|
||||||
@\
|
@\
|
||||||
pip install -r dev-requirements.txt -r editable-requirements.txt
|
pip install -r dev-requirements.txt -r editable-requirements.txt
|
||||||
|
|
||||||
.PHONY: dev
|
|
||||||
dev: dev_req ## Installs dbt-* packages in develop mode along with development dependencies and pre-commit.
|
|
||||||
@\
|
|
||||||
pre-commit install
|
|
||||||
|
|
||||||
.PHONY: mypy
|
.PHONY: mypy
|
||||||
mypy: .env ## Runs mypy against staged changes for static type checking.
|
mypy: .env ## Runs mypy against staged changes for static type checking.
|
||||||
@\
|
@\
|
||||||
|
|||||||
@@ -2,59 +2,50 @@
|
|||||||
|
|
||||||
## The following are individual files in this directory.
|
## The following are individual files in this directory.
|
||||||
|
|
||||||
### compilation.py
|
|
||||||
|
|
||||||
### constants.py
|
|
||||||
|
|
||||||
### dataclass_schema.py
|
|
||||||
|
|
||||||
### deprecations.py
|
### deprecations.py
|
||||||
|
|
||||||
### exceptions.py
|
|
||||||
|
|
||||||
### flags.py
|
### flags.py
|
||||||
|
|
||||||
### helper_types.py
|
|
||||||
|
|
||||||
### hooks.py
|
|
||||||
|
|
||||||
### lib.py
|
|
||||||
|
|
||||||
### links.py
|
|
||||||
|
|
||||||
### logger.py
|
|
||||||
|
|
||||||
### main.py
|
### main.py
|
||||||
|
|
||||||
### node_types.py
|
|
||||||
|
|
||||||
### profiler.py
|
|
||||||
|
|
||||||
### selected_resources.py
|
|
||||||
|
|
||||||
### semver.py
|
|
||||||
|
|
||||||
### tracking.py
|
### tracking.py
|
||||||
|
|
||||||
|
### version.py
|
||||||
|
|
||||||
|
### lib.py
|
||||||
|
|
||||||
|
### node_types.py
|
||||||
|
|
||||||
|
### helper_types.py
|
||||||
|
|
||||||
|
### links.py
|
||||||
|
|
||||||
|
### semver.py
|
||||||
|
|
||||||
### ui.py
|
### ui.py
|
||||||
|
|
||||||
|
### compilation.py
|
||||||
|
|
||||||
|
### dataclass_schema.py
|
||||||
|
|
||||||
|
### exceptions.py
|
||||||
|
|
||||||
|
### hooks.py
|
||||||
|
|
||||||
|
### logger.py
|
||||||
|
|
||||||
|
### profiler.py
|
||||||
|
|
||||||
### utils.py
|
### utils.py
|
||||||
|
|
||||||
### version.py
|
|
||||||
|
|
||||||
|
|
||||||
## The subdirectories will be documented in a README in the subdirectory
|
## The subdirectories will be documented in a README in the subdirectory
|
||||||
* adapters
|
|
||||||
* cli
|
|
||||||
* clients
|
|
||||||
* config
|
* config
|
||||||
* context
|
|
||||||
* contracts
|
|
||||||
* deps
|
|
||||||
* docs
|
|
||||||
* events
|
|
||||||
* graph
|
|
||||||
* include
|
* include
|
||||||
* parser
|
* adapters
|
||||||
|
* context
|
||||||
|
* deps
|
||||||
|
* graph
|
||||||
* task
|
* task
|
||||||
* tests
|
* clients
|
||||||
|
* events
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from dataclasses import dataclass
|
|||||||
import re
|
import re
|
||||||
from typing import Dict, ClassVar, Any, Optional
|
from typing import Dict, ClassVar, Any, Optional
|
||||||
|
|
||||||
from dbt.exceptions import DbtRuntimeError
|
from dbt.exceptions import RuntimeException
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -12,7 +12,6 @@ class Column:
|
|||||||
"TIMESTAMP": "TIMESTAMP",
|
"TIMESTAMP": "TIMESTAMP",
|
||||||
"FLOAT": "FLOAT",
|
"FLOAT": "FLOAT",
|
||||||
"INTEGER": "INT",
|
"INTEGER": "INT",
|
||||||
"BOOLEAN": "BOOLEAN",
|
|
||||||
}
|
}
|
||||||
column: str
|
column: str
|
||||||
dtype: str
|
dtype: str
|
||||||
@@ -85,7 +84,7 @@ class Column:
|
|||||||
|
|
||||||
def string_size(self) -> int:
|
def string_size(self) -> int:
|
||||||
if not self.is_string():
|
if not self.is_string():
|
||||||
raise DbtRuntimeError("Called string_size() on non-string field!")
|
raise RuntimeException("Called string_size() on non-string field!")
|
||||||
|
|
||||||
if self.dtype == "text" or self.char_size is None:
|
if self.dtype == "text" or self.char_size is None:
|
||||||
# char_size should never be None. Handle it reasonably just in case
|
# char_size should never be None. Handle it reasonably just in case
|
||||||
@@ -124,7 +123,7 @@ class Column:
|
|||||||
def from_description(cls, name: str, raw_data_type: str) -> "Column":
|
def from_description(cls, name: str, raw_data_type: str) -> "Column":
|
||||||
match = re.match(r"([^(]+)(\([^)]+\))?", raw_data_type)
|
match = re.match(r"([^(]+)(\([^)]+\))?", raw_data_type)
|
||||||
if match is None:
|
if match is None:
|
||||||
raise DbtRuntimeError(f'Could not interpret data type "{raw_data_type}"')
|
raise RuntimeException(f'Could not interpret data type "{raw_data_type}"')
|
||||||
data_type, size_info = match.groups()
|
data_type, size_info = match.groups()
|
||||||
char_size = None
|
char_size = None
|
||||||
numeric_precision = None
|
numeric_precision = None
|
||||||
@@ -137,7 +136,7 @@ class Column:
|
|||||||
try:
|
try:
|
||||||
char_size = int(parts[0])
|
char_size = int(parts[0])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
f'Could not interpret data_type "{raw_data_type}": '
|
f'Could not interpret data_type "{raw_data_type}": '
|
||||||
f'could not convert "{parts[0]}" to an integer'
|
f'could not convert "{parts[0]}" to an integer'
|
||||||
)
|
)
|
||||||
@@ -145,14 +144,14 @@ class Column:
|
|||||||
try:
|
try:
|
||||||
numeric_precision = int(parts[0])
|
numeric_precision = int(parts[0])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
f'Could not interpret data_type "{raw_data_type}": '
|
f'Could not interpret data_type "{raw_data_type}": '
|
||||||
f'could not convert "{parts[0]}" to an integer'
|
f'could not convert "{parts[0]}" to an integer'
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
numeric_scale = int(parts[1])
|
numeric_scale = int(parts[1])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
f'Could not interpret data_type "{raw_data_type}": '
|
f'Could not interpret data_type "{raw_data_type}": '
|
||||||
f'could not convert "{parts[1]}" to an integer'
|
f'could not convert "{parts[1]}" to an integer'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import abc
|
|||||||
import os
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
|
||||||
|
|
||||||
# multiprocessing.RLock is a function returning this type
|
# multiprocessing.RLock is a function returning this type
|
||||||
from multiprocessing.synchronize import RLock
|
from multiprocessing.synchronize import RLock
|
||||||
@@ -41,16 +40,14 @@ from dbt.events.functions import fire_event
|
|||||||
from dbt.events.types import (
|
from dbt.events.types import (
|
||||||
NewConnection,
|
NewConnection,
|
||||||
ConnectionReused,
|
ConnectionReused,
|
||||||
ConnectionLeftOpenInCleanup,
|
|
||||||
ConnectionLeftOpen,
|
ConnectionLeftOpen,
|
||||||
ConnectionClosedInCleanup,
|
ConnectionLeftOpen2,
|
||||||
ConnectionClosed,
|
ConnectionClosed,
|
||||||
|
ConnectionClosed2,
|
||||||
Rollback,
|
Rollback,
|
||||||
RollbackFailed,
|
RollbackFailed,
|
||||||
)
|
)
|
||||||
from dbt.events.contextvars import get_node_info
|
|
||||||
from dbt import flags
|
from dbt import flags
|
||||||
from dbt.utils import cast_to_str
|
|
||||||
|
|
||||||
SleepTime = Union[int, float] # As taken by time.sleep.
|
SleepTime = Union[int, float] # As taken by time.sleep.
|
||||||
AdapterHandle = Any # Adapter connection handle objects can be any class.
|
AdapterHandle = Any # Adapter connection handle objects can be any class.
|
||||||
@@ -91,13 +88,13 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
key = self.get_thread_identifier()
|
key = self.get_thread_identifier()
|
||||||
with self.lock:
|
with self.lock:
|
||||||
if key not in self.thread_connections:
|
if key not in self.thread_connections:
|
||||||
raise dbt.exceptions.InvalidConnectionError(key, list(self.thread_connections))
|
raise dbt.exceptions.InvalidConnectionException(key, list(self.thread_connections))
|
||||||
return self.thread_connections[key]
|
return self.thread_connections[key]
|
||||||
|
|
||||||
def set_thread_connection(self, conn: Connection) -> None:
|
def set_thread_connection(self, conn: Connection) -> None:
|
||||||
key = self.get_thread_identifier()
|
key = self.get_thread_identifier()
|
||||||
if key in self.thread_connections:
|
if key in self.thread_connections:
|
||||||
raise dbt.exceptions.DbtInternalError(
|
raise dbt.exceptions.InternalException(
|
||||||
"In set_thread_connection, existing connection exists for {}"
|
"In set_thread_connection, existing connection exists for {}"
|
||||||
)
|
)
|
||||||
self.thread_connections[key] = conn
|
self.thread_connections[key] = conn
|
||||||
@@ -137,49 +134,47 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
:return: A context manager that handles exceptions raised by the
|
:return: A context manager that handles exceptions raised by the
|
||||||
underlying database.
|
underlying database.
|
||||||
"""
|
"""
|
||||||
raise dbt.exceptions.NotImplementedError(
|
raise dbt.exceptions.NotImplementedException(
|
||||||
"`exception_handler` is not implemented for this adapter!"
|
"`exception_handler` is not implemented for this adapter!"
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_connection_name(self, name: Optional[str] = None) -> Connection:
|
def set_connection_name(self, name: Optional[str] = None) -> Connection:
|
||||||
"""Called by 'acquire_connection' in BaseAdapter, which is called by
|
conn_name: str
|
||||||
'connection_named', called by 'connection_for(node)'.
|
if name is None:
|
||||||
Creates a connection for this thread if one doesn't already
|
# if a name isn't specified, we'll re-use a single handle
|
||||||
exist, and will rename an existing connection."""
|
# named 'master'
|
||||||
|
conn_name = "master"
|
||||||
|
else:
|
||||||
|
if not isinstance(name, str):
|
||||||
|
raise dbt.exceptions.CompilerException(
|
||||||
|
f"For connection name, got {name} - not a string!"
|
||||||
|
)
|
||||||
|
assert isinstance(name, str)
|
||||||
|
conn_name = name
|
||||||
|
|
||||||
conn_name: str = "master" if name is None else name
|
|
||||||
|
|
||||||
# Get a connection for this thread
|
|
||||||
conn = self.get_if_exists()
|
conn = self.get_if_exists()
|
||||||
|
|
||||||
if conn and conn.name == conn_name and conn.state == "open":
|
|
||||||
# Found a connection and nothing to do, so just return it
|
|
||||||
return conn
|
|
||||||
|
|
||||||
if conn is None:
|
if conn is None:
|
||||||
# Create a new connection
|
|
||||||
conn = Connection(
|
conn = Connection(
|
||||||
type=Identifier(self.TYPE),
|
type=Identifier(self.TYPE),
|
||||||
name=conn_name,
|
name=None,
|
||||||
state=ConnectionState.INIT,
|
state=ConnectionState.INIT,
|
||||||
transaction_open=False,
|
transaction_open=False,
|
||||||
handle=None,
|
handle=None,
|
||||||
credentials=self.profile.credentials,
|
credentials=self.profile.credentials,
|
||||||
)
|
)
|
||||||
conn.handle = LazyHandle(self.open)
|
|
||||||
# Add the connection to thread_connections for this thread
|
|
||||||
self.set_thread_connection(conn)
|
self.set_thread_connection(conn)
|
||||||
fire_event(
|
|
||||||
NewConnection(conn_name=conn_name, conn_type=self.TYPE, node_info=get_node_info())
|
|
||||||
)
|
|
||||||
else: # existing connection either wasn't open or didn't have the right name
|
|
||||||
if conn.state != "open":
|
|
||||||
conn.handle = LazyHandle(self.open)
|
|
||||||
if conn.name != conn_name:
|
|
||||||
orig_conn_name: str = conn.name or ""
|
|
||||||
conn.name = conn_name
|
|
||||||
fire_event(ConnectionReused(orig_conn_name=orig_conn_name, conn_name=conn_name))
|
|
||||||
|
|
||||||
|
if conn.name == conn_name and conn.state == "open":
|
||||||
|
return conn
|
||||||
|
|
||||||
|
fire_event(NewConnection(conn_name=conn_name, conn_type=self.TYPE))
|
||||||
|
|
||||||
|
if conn.state == "open":
|
||||||
|
fire_event(ConnectionReused(conn_name=conn_name))
|
||||||
|
else:
|
||||||
|
conn.handle = LazyHandle(self.open)
|
||||||
|
|
||||||
|
conn.name = conn_name
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -211,7 +206,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
connect should trigger a retry.
|
connect should trigger a retry.
|
||||||
:type retryable_exceptions: Iterable[Type[Exception]]
|
:type retryable_exceptions: Iterable[Type[Exception]]
|
||||||
:param int retry_limit: How many times to retry the call to connect. If this limit
|
:param int retry_limit: How many times to retry the call to connect. If this limit
|
||||||
is exceeded before a successful call, a FailedToConnectError will be raised.
|
is exceeded before a successful call, a FailedToConnectException will be raised.
|
||||||
Must be non-negative.
|
Must be non-negative.
|
||||||
:param retry_timeout: Time to wait between attempts to connect. Can also take a
|
:param retry_timeout: Time to wait between attempts to connect. Can also take a
|
||||||
Callable that takes the number of attempts so far, beginning at 0, and returns an int
|
Callable that takes the number of attempts so far, beginning at 0, and returns an int
|
||||||
@@ -220,14 +215,14 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
:param int _attempts: Parameter used to keep track of the number of attempts in calling the
|
:param int _attempts: Parameter used to keep track of the number of attempts in calling the
|
||||||
connect function across recursive calls. Passed as an argument to retry_timeout if it
|
connect function across recursive calls. Passed as an argument to retry_timeout if it
|
||||||
is a Callable. This parameter should not be set by the initial caller.
|
is a Callable. This parameter should not be set by the initial caller.
|
||||||
:raises dbt.exceptions.FailedToConnectError: Upon exhausting all retry attempts without
|
:raises dbt.exceptions.FailedToConnectException: Upon exhausting all retry attempts without
|
||||||
successfully acquiring a handle.
|
successfully acquiring a handle.
|
||||||
:return: The given connection with its appropriate state and handle attributes set
|
:return: The given connection with its appropriate state and handle attributes set
|
||||||
depending on whether we successfully acquired a handle or not.
|
depending on whether we successfully acquired a handle or not.
|
||||||
"""
|
"""
|
||||||
timeout = retry_timeout(_attempts) if callable(retry_timeout) else retry_timeout
|
timeout = retry_timeout(_attempts) if callable(retry_timeout) else retry_timeout
|
||||||
if timeout < 0:
|
if timeout < 0:
|
||||||
raise dbt.exceptions.FailedToConnectError(
|
raise dbt.exceptions.FailedToConnectException(
|
||||||
"retry_timeout cannot be negative or return a negative time."
|
"retry_timeout cannot be negative or return a negative time."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -235,7 +230,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
# This guard is not perfect others may add to the recursion limit (e.g. built-ins).
|
# This guard is not perfect others may add to the recursion limit (e.g. built-ins).
|
||||||
connection.handle = None
|
connection.handle = None
|
||||||
connection.state = ConnectionState.FAIL
|
connection.state = ConnectionState.FAIL
|
||||||
raise dbt.exceptions.FailedToConnectError("retry_limit cannot be negative")
|
raise dbt.exceptions.FailedToConnectException("retry_limit cannot be negative")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.handle = connect()
|
connection.handle = connect()
|
||||||
@@ -246,7 +241,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
if retry_limit <= 0:
|
if retry_limit <= 0:
|
||||||
connection.handle = None
|
connection.handle = None
|
||||||
connection.state = ConnectionState.FAIL
|
connection.state = ConnectionState.FAIL
|
||||||
raise dbt.exceptions.FailedToConnectError(str(e))
|
raise dbt.exceptions.FailedToConnectException(str(e))
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Got a retryable error when attempting to open a {cls.TYPE} connection.\n"
|
f"Got a retryable error when attempting to open a {cls.TYPE} connection.\n"
|
||||||
@@ -268,12 +263,12 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
connection.handle = None
|
connection.handle = None
|
||||||
connection.state = ConnectionState.FAIL
|
connection.state = ConnectionState.FAIL
|
||||||
raise dbt.exceptions.FailedToConnectError(str(e))
|
raise dbt.exceptions.FailedToConnectException(str(e))
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def cancel_open(self) -> Optional[List[str]]:
|
def cancel_open(self) -> Optional[List[str]]:
|
||||||
"""Cancel all open connections on the adapter. (passable)"""
|
"""Cancel all open connections on the adapter. (passable)"""
|
||||||
raise dbt.exceptions.NotImplementedError(
|
raise dbt.exceptions.NotImplementedException(
|
||||||
"`cancel_open` is not implemented for this adapter!"
|
"`cancel_open` is not implemented for this adapter!"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,7 +283,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
This should be thread-safe, or hold the lock if necessary. The given
|
This should be thread-safe, or hold the lock if necessary. The given
|
||||||
connection should not be in either in_use or available.
|
connection should not be in either in_use or available.
|
||||||
"""
|
"""
|
||||||
raise dbt.exceptions.NotImplementedError("`open` is not implemented for this adapter!")
|
raise dbt.exceptions.NotImplementedException("`open` is not implemented for this adapter!")
|
||||||
|
|
||||||
def release(self) -> None:
|
def release(self) -> None:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
@@ -309,9 +304,9 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
with self.lock:
|
with self.lock:
|
||||||
for connection in self.thread_connections.values():
|
for connection in self.thread_connections.values():
|
||||||
if connection.state not in {"closed", "init"}:
|
if connection.state not in {"closed", "init"}:
|
||||||
fire_event(ConnectionLeftOpenInCleanup(conn_name=cast_to_str(connection.name)))
|
fire_event(ConnectionLeftOpen(conn_name=connection.name))
|
||||||
else:
|
else:
|
||||||
fire_event(ConnectionClosedInCleanup(conn_name=cast_to_str(connection.name)))
|
fire_event(ConnectionClosed(conn_name=connection.name))
|
||||||
self.close(connection)
|
self.close(connection)
|
||||||
|
|
||||||
# garbage collect these connections
|
# garbage collect these connections
|
||||||
@@ -320,12 +315,16 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def begin(self) -> None:
|
def begin(self) -> None:
|
||||||
"""Begin a transaction. (passable)"""
|
"""Begin a transaction. (passable)"""
|
||||||
raise dbt.exceptions.NotImplementedError("`begin` is not implemented for this adapter!")
|
raise dbt.exceptions.NotImplementedException(
|
||||||
|
"`begin` is not implemented for this adapter!"
|
||||||
|
)
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def commit(self) -> None:
|
def commit(self) -> None:
|
||||||
"""Commit a transaction. (passable)"""
|
"""Commit a transaction. (passable)"""
|
||||||
raise dbt.exceptions.NotImplementedError("`commit` is not implemented for this adapter!")
|
raise dbt.exceptions.NotImplementedException(
|
||||||
|
"`commit` is not implemented for this adapter!"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _rollback_handle(cls, connection: Connection) -> None:
|
def _rollback_handle(cls, connection: Connection) -> None:
|
||||||
@@ -333,40 +332,28 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
try:
|
try:
|
||||||
connection.handle.rollback()
|
connection.handle.rollback()
|
||||||
except Exception:
|
except Exception:
|
||||||
fire_event(
|
fire_event(RollbackFailed(conn_name=connection.name))
|
||||||
RollbackFailed(
|
|
||||||
conn_name=cast_to_str(connection.name),
|
|
||||||
exc_info=traceback.format_exc(),
|
|
||||||
node_info=get_node_info(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _close_handle(cls, connection: Connection) -> None:
|
def _close_handle(cls, connection: Connection) -> None:
|
||||||
"""Perform the actual close operation."""
|
"""Perform the actual close operation."""
|
||||||
# On windows, sometimes connection handles don't have a close() attr.
|
# On windows, sometimes connection handles don't have a close() attr.
|
||||||
if hasattr(connection.handle, "close"):
|
if hasattr(connection.handle, "close"):
|
||||||
fire_event(
|
fire_event(ConnectionClosed2(conn_name=connection.name))
|
||||||
ConnectionClosed(conn_name=cast_to_str(connection.name), node_info=get_node_info())
|
|
||||||
)
|
|
||||||
connection.handle.close()
|
connection.handle.close()
|
||||||
else:
|
else:
|
||||||
fire_event(
|
fire_event(ConnectionLeftOpen2(conn_name=connection.name))
|
||||||
ConnectionLeftOpen(
|
|
||||||
conn_name=cast_to_str(connection.name), node_info=get_node_info()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _rollback(cls, connection: Connection) -> None:
|
def _rollback(cls, connection: Connection) -> None:
|
||||||
"""Roll back the given connection."""
|
"""Roll back the given connection."""
|
||||||
if connection.transaction_open is False:
|
if connection.transaction_open is False:
|
||||||
raise dbt.exceptions.DbtInternalError(
|
raise dbt.exceptions.InternalException(
|
||||||
f"Tried to rollback transaction on connection "
|
f"Tried to rollback transaction on connection "
|
||||||
f'"{connection.name}", but it does not have one open!'
|
f'"{connection.name}", but it does not have one open!'
|
||||||
)
|
)
|
||||||
|
|
||||||
fire_event(Rollback(conn_name=cast_to_str(connection.name), node_info=get_node_info()))
|
fire_event(Rollback(conn_name=connection.name))
|
||||||
cls._rollback_handle(connection)
|
cls._rollback_handle(connection)
|
||||||
|
|
||||||
connection.transaction_open = False
|
connection.transaction_open = False
|
||||||
@@ -378,7 +365,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
return connection
|
return connection
|
||||||
|
|
||||||
if connection.transaction_open and connection.handle:
|
if connection.transaction_open and connection.handle:
|
||||||
fire_event(Rollback(conn_name=cast_to_str(connection.name), node_info=get_node_info()))
|
fire_event(Rollback(conn_name=connection.name))
|
||||||
cls._rollback_handle(connection)
|
cls._rollback_handle(connection)
|
||||||
connection.transaction_open = False
|
connection.transaction_open = False
|
||||||
|
|
||||||
@@ -411,4 +398,6 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
|
|||||||
:return: A tuple of the query status and results (empty if fetch=False).
|
:return: A tuple of the query status and results (empty if fetch=False).
|
||||||
:rtype: Tuple[AdapterResponse, agate.Table]
|
:rtype: Tuple[AdapterResponse, agate.Table]
|
||||||
"""
|
"""
|
||||||
raise dbt.exceptions.NotImplementedError("`execute` is not implemented for this adapter!")
|
raise dbt.exceptions.NotImplementedException(
|
||||||
|
"`execute` is not implemented for this adapter!"
|
||||||
|
)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from typing import (
|
|||||||
List,
|
List,
|
||||||
Mapping,
|
Mapping,
|
||||||
Iterator,
|
Iterator,
|
||||||
|
Union,
|
||||||
Set,
|
Set,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,20 +23,13 @@ import agate
|
|||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from dbt.exceptions import (
|
from dbt.exceptions import (
|
||||||
DbtInternalError,
|
raise_database_error,
|
||||||
MacroArgTypeError,
|
raise_compiler_error,
|
||||||
MacroResultError,
|
invalid_type_error,
|
||||||
QuoteConfigTypeError,
|
get_relation_returned_multiple_results,
|
||||||
NotImplementedError,
|
InternalException,
|
||||||
NullRelationCacheAttemptedError,
|
NotImplementedException,
|
||||||
NullRelationDropAttemptedError,
|
RuntimeException,
|
||||||
RelationReturnedMultipleResultsError,
|
|
||||||
RenameToNoneAttemptedError,
|
|
||||||
DbtRuntimeError,
|
|
||||||
SnapshotTargetIncompleteError,
|
|
||||||
SnapshotTargetNotSnapshotTableError,
|
|
||||||
UnexpectedNullError,
|
|
||||||
UnexpectedNonTimestampError,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from dbt.adapters.protocol import (
|
from dbt.adapters.protocol import (
|
||||||
@@ -44,17 +38,18 @@ from dbt.adapters.protocol import (
|
|||||||
)
|
)
|
||||||
from dbt.clients.agate_helper import empty_table, merge_tables, table_from_rows
|
from dbt.clients.agate_helper import empty_table, merge_tables, table_from_rows
|
||||||
from dbt.clients.jinja import MacroGenerator
|
from dbt.clients.jinja import MacroGenerator
|
||||||
|
from dbt.contracts.graph.compiled import CompileResultNode, CompiledSeedNode
|
||||||
from dbt.contracts.graph.manifest import Manifest, MacroManifest
|
from dbt.contracts.graph.manifest import Manifest, MacroManifest
|
||||||
from dbt.contracts.graph.nodes import ResultNode
|
from dbt.contracts.graph.parsed import ParsedSeedNode
|
||||||
from dbt.events.functions import fire_event, warn_or_error
|
from dbt.exceptions import warn_or_error
|
||||||
|
from dbt.events.functions import fire_event
|
||||||
from dbt.events.types import (
|
from dbt.events.types import (
|
||||||
CacheMiss,
|
CacheMiss,
|
||||||
ListRelations,
|
ListRelations,
|
||||||
CodeExecution,
|
CodeExecution,
|
||||||
CodeExecutionStatus,
|
CodeExecutionStatus,
|
||||||
CatalogGenerationError,
|
|
||||||
)
|
)
|
||||||
from dbt.utils import filter_null_values, executor, cast_to_str
|
from dbt.utils import filter_null_values, executor
|
||||||
|
|
||||||
from dbt.adapters.base.connections import Connection, AdapterResponse
|
from dbt.adapters.base.connections import Connection, AdapterResponse
|
||||||
from dbt.adapters.base.meta import AdapterMeta, available
|
from dbt.adapters.base.meta import AdapterMeta, available
|
||||||
@@ -66,7 +61,10 @@ from dbt.adapters.base.relation import (
|
|||||||
)
|
)
|
||||||
from dbt.adapters.base import Column as BaseColumn
|
from dbt.adapters.base import Column as BaseColumn
|
||||||
from dbt.adapters.base import Credentials
|
from dbt.adapters.base import Credentials
|
||||||
from dbt.adapters.cache import RelationsCache, _make_ref_key_msg
|
from dbt.adapters.cache import RelationsCache, _make_key
|
||||||
|
|
||||||
|
|
||||||
|
SeedModel = Union[ParsedSeedNode, CompiledSeedNode]
|
||||||
|
|
||||||
|
|
||||||
GET_CATALOG_MACRO_NAME = "get_catalog"
|
GET_CATALOG_MACRO_NAME = "get_catalog"
|
||||||
@@ -75,7 +73,7 @@ FRESHNESS_MACRO_NAME = "collect_freshness"
|
|||||||
|
|
||||||
def _expect_row_value(key: str, row: agate.Row):
|
def _expect_row_value(key: str, row: agate.Row):
|
||||||
if key not in row.keys():
|
if key not in row.keys():
|
||||||
raise DbtInternalError(
|
raise InternalException(
|
||||||
'Got a row without "{}" column, columns: {}'.format(key, row.keys())
|
'Got a row without "{}" column, columns: {}'.format(key, row.keys())
|
||||||
)
|
)
|
||||||
return row[key]
|
return row[key]
|
||||||
@@ -104,10 +102,18 @@ def _utc(dt: Optional[datetime], source: BaseRelation, field_name: str) -> datet
|
|||||||
assume the datetime is already for UTC and add the timezone.
|
assume the datetime is already for UTC and add the timezone.
|
||||||
"""
|
"""
|
||||||
if dt is None:
|
if dt is None:
|
||||||
raise UnexpectedNullError(field_name, source)
|
raise raise_database_error(
|
||||||
|
"Expected a non-null value when querying field '{}' of table "
|
||||||
|
" {} but received value 'null' instead".format(field_name, source)
|
||||||
|
)
|
||||||
|
|
||||||
elif not hasattr(dt, "tzinfo"):
|
elif not hasattr(dt, "tzinfo"):
|
||||||
raise UnexpectedNonTimestampError(field_name, source, dt)
|
raise raise_database_error(
|
||||||
|
"Expected a timestamp value when querying field '{}' of table "
|
||||||
|
"{} but received value of type '{}' instead".format(
|
||||||
|
field_name, source, type(dt).__name__
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
elif dt.tzinfo:
|
elif dt.tzinfo:
|
||||||
return dt.astimezone(pytz.UTC)
|
return dt.astimezone(pytz.UTC)
|
||||||
@@ -237,7 +243,9 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
return conn.name
|
return conn.name
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def connection_named(self, name: str, node: Optional[ResultNode] = None) -> Iterator[None]:
|
def connection_named(
|
||||||
|
self, name: str, node: Optional[CompileResultNode] = None
|
||||||
|
) -> Iterator[None]:
|
||||||
try:
|
try:
|
||||||
if self.connections.query_header is not None:
|
if self.connections.query_header is not None:
|
||||||
self.connections.query_header.set(name, node)
|
self.connections.query_header.set(name, node)
|
||||||
@@ -249,7 +257,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
self.connections.query_header.reset()
|
self.connections.query_header.reset()
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def connection_for(self, node: ResultNode) -> Iterator[None]:
|
def connection_for(self, node: CompileResultNode) -> Iterator[None]:
|
||||||
with self.connection_named(node.unique_id, node):
|
with self.connection_named(node.unique_id, node):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
@@ -335,7 +343,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
fire_event(
|
fire_event(
|
||||||
CacheMiss(
|
CacheMiss(
|
||||||
conn_name=self.nice_connection_name(),
|
conn_name=self.nice_connection_name(),
|
||||||
database=cast_to_str(database),
|
database=database,
|
||||||
schema=schema,
|
schema=schema,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -364,7 +372,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
lowercase strings.
|
lowercase strings.
|
||||||
"""
|
"""
|
||||||
info_schema_name_map = SchemaSearchMap()
|
info_schema_name_map = SchemaSearchMap()
|
||||||
nodes: Iterator[ResultNode] = chain(
|
nodes: Iterator[CompileResultNode] = chain(
|
||||||
[
|
[
|
||||||
node
|
node
|
||||||
for node in manifest.nodes.values()
|
for node in manifest.nodes.values()
|
||||||
@@ -433,7 +441,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
"""Cache a new relation in dbt. It will show up in `list relations`."""
|
"""Cache a new relation in dbt. It will show up in `list relations`."""
|
||||||
if relation is None:
|
if relation is None:
|
||||||
name = self.nice_connection_name()
|
name = self.nice_connection_name()
|
||||||
raise NullRelationCacheAttemptedError(name)
|
raise_compiler_error("Attempted to cache a null relation for {}".format(name))
|
||||||
self.cache.add(relation)
|
self.cache.add(relation)
|
||||||
# so jinja doesn't render things
|
# so jinja doesn't render things
|
||||||
return ""
|
return ""
|
||||||
@@ -445,7 +453,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
"""
|
"""
|
||||||
if relation is None:
|
if relation is None:
|
||||||
name = self.nice_connection_name()
|
name = self.nice_connection_name()
|
||||||
raise NullRelationDropAttemptedError(name)
|
raise_compiler_error("Attempted to drop a null relation for {}".format(name))
|
||||||
self.cache.drop(relation)
|
self.cache.drop(relation)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@@ -462,7 +470,9 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
name = self.nice_connection_name()
|
name = self.nice_connection_name()
|
||||||
src_name = _relation_name(from_relation)
|
src_name = _relation_name(from_relation)
|
||||||
dst_name = _relation_name(to_relation)
|
dst_name = _relation_name(to_relation)
|
||||||
raise RenameToNoneAttemptedError(src_name, dst_name, name)
|
raise_compiler_error(
|
||||||
|
"Attempted to rename {} to {} for {}".format(src_name, dst_name, name)
|
||||||
|
)
|
||||||
|
|
||||||
self.cache.rename(from_relation, to_relation)
|
self.cache.rename(from_relation, to_relation)
|
||||||
return ""
|
return ""
|
||||||
@@ -474,12 +484,12 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def date_function(cls) -> str:
|
def date_function(cls) -> str:
|
||||||
"""Get the date function used by this adapter's database."""
|
"""Get the date function used by this adapter's database."""
|
||||||
raise NotImplementedError("`date_function` is not implemented for this adapter!")
|
raise NotImplementedException("`date_function` is not implemented for this adapter!")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def is_cancelable(cls) -> bool:
|
def is_cancelable(cls) -> bool:
|
||||||
raise NotImplementedError("`is_cancelable` is not implemented for this adapter!")
|
raise NotImplementedException("`is_cancelable` is not implemented for this adapter!")
|
||||||
|
|
||||||
###
|
###
|
||||||
# Abstract methods about schemas
|
# Abstract methods about schemas
|
||||||
@@ -487,7 +497,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def list_schemas(self, database: str) -> List[str]:
|
def list_schemas(self, database: str) -> List[str]:
|
||||||
"""Get a list of existing schemas in database"""
|
"""Get a list of existing schemas in database"""
|
||||||
raise NotImplementedError("`list_schemas` is not implemented for this adapter!")
|
raise NotImplementedException("`list_schemas` is not implemented for this adapter!")
|
||||||
|
|
||||||
@available.parse(lambda *a, **k: False)
|
@available.parse(lambda *a, **k: False)
|
||||||
def check_schema_exists(self, database: str, schema: str) -> bool:
|
def check_schema_exists(self, database: str, schema: str) -> bool:
|
||||||
@@ -510,13 +520,13 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
|
|
||||||
*Implementors must call self.cache.drop() to preserve cache state!*
|
*Implementors must call self.cache.drop() to preserve cache state!*
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`drop_relation` is not implemented for this adapter!")
|
raise NotImplementedException("`drop_relation` is not implemented for this adapter!")
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@available.parse_none
|
@available.parse_none
|
||||||
def truncate_relation(self, relation: BaseRelation) -> None:
|
def truncate_relation(self, relation: BaseRelation) -> None:
|
||||||
"""Truncate the given relation."""
|
"""Truncate the given relation."""
|
||||||
raise NotImplementedError("`truncate_relation` is not implemented for this adapter!")
|
raise NotImplementedException("`truncate_relation` is not implemented for this adapter!")
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@available.parse_none
|
@available.parse_none
|
||||||
@@ -525,13 +535,15 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
|
|
||||||
Implementors must call self.cache.rename() to preserve cache state.
|
Implementors must call self.cache.rename() to preserve cache state.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`rename_relation` is not implemented for this adapter!")
|
raise NotImplementedException("`rename_relation` is not implemented for this adapter!")
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@available.parse_list
|
@available.parse_list
|
||||||
def get_columns_in_relation(self, relation: BaseRelation) -> List[BaseColumn]:
|
def get_columns_in_relation(self, relation: BaseRelation) -> List[BaseColumn]:
|
||||||
"""Get a list of the columns in the given Relation."""
|
"""Get a list of the columns in the given Relation."""
|
||||||
raise NotImplementedError("`get_columns_in_relation` is not implemented for this adapter!")
|
raise NotImplementedException(
|
||||||
|
"`get_columns_in_relation` is not implemented for this adapter!"
|
||||||
|
)
|
||||||
|
|
||||||
@available.deprecated("get_columns_in_relation", lambda *a, **k: [])
|
@available.deprecated("get_columns_in_relation", lambda *a, **k: [])
|
||||||
def get_columns_in_table(self, schema: str, identifier: str) -> List[BaseColumn]:
|
def get_columns_in_table(self, schema: str, identifier: str) -> List[BaseColumn]:
|
||||||
@@ -553,7 +565,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param self.Relation current: A relation that currently exists in the
|
:param self.Relation current: A relation that currently exists in the
|
||||||
database with columns of unspecified types.
|
database with columns of unspecified types.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError(
|
raise NotImplementedException(
|
||||||
"`expand_target_column_types` is not implemented for this adapter!"
|
"`expand_target_column_types` is not implemented for this adapter!"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -568,8 +580,8 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:return: The relations in schema
|
:return: The relations in schema
|
||||||
:rtype: List[self.Relation]
|
:rtype: List[self.Relation]
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError(
|
raise NotImplementedException(
|
||||||
"`list_relations_without_caching` is not implemented for this adapter!"
|
"`list_relations_without_caching` is not implemented for this " "adapter!"
|
||||||
)
|
)
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -610,7 +622,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
to_relation.
|
to_relation.
|
||||||
"""
|
"""
|
||||||
if not isinstance(from_relation, self.Relation):
|
if not isinstance(from_relation, self.Relation):
|
||||||
raise MacroArgTypeError(
|
invalid_type_error(
|
||||||
method_name="get_missing_columns",
|
method_name="get_missing_columns",
|
||||||
arg_name="from_relation",
|
arg_name="from_relation",
|
||||||
got_value=from_relation,
|
got_value=from_relation,
|
||||||
@@ -618,7 +630,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not isinstance(to_relation, self.Relation):
|
if not isinstance(to_relation, self.Relation):
|
||||||
raise MacroArgTypeError(
|
invalid_type_error(
|
||||||
method_name="get_missing_columns",
|
method_name="get_missing_columns",
|
||||||
arg_name="to_relation",
|
arg_name="to_relation",
|
||||||
got_value=to_relation,
|
got_value=to_relation,
|
||||||
@@ -639,11 +651,11 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
expected columns.
|
expected columns.
|
||||||
|
|
||||||
:param Relation relation: The relation to check
|
:param Relation relation: The relation to check
|
||||||
:raises InvalidMacroArgType: If the columns are
|
:raises CompilationException: If the columns are
|
||||||
incorrect.
|
incorrect.
|
||||||
"""
|
"""
|
||||||
if not isinstance(relation, self.Relation):
|
if not isinstance(relation, self.Relation):
|
||||||
raise MacroArgTypeError(
|
invalid_type_error(
|
||||||
method_name="valid_snapshot_target",
|
method_name="valid_snapshot_target",
|
||||||
arg_name="relation",
|
arg_name="relation",
|
||||||
got_value=relation,
|
got_value=relation,
|
||||||
@@ -664,16 +676,24 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
|
|
||||||
if missing:
|
if missing:
|
||||||
if extra:
|
if extra:
|
||||||
raise SnapshotTargetIncompleteError(extra, missing)
|
msg = (
|
||||||
|
'Snapshot target has ("{}") but not ("{}") - is it an '
|
||||||
|
"unmigrated previous version archive?".format(
|
||||||
|
'", "'.join(extra), '", "'.join(missing)
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
raise SnapshotTargetNotSnapshotTableError(missing)
|
msg = 'Snapshot target is not a snapshot table (missing "{}")'.format(
|
||||||
|
'", "'.join(missing)
|
||||||
|
)
|
||||||
|
raise_compiler_error(msg)
|
||||||
|
|
||||||
@available.parse_none
|
@available.parse_none
|
||||||
def expand_target_column_types(
|
def expand_target_column_types(
|
||||||
self, from_relation: BaseRelation, to_relation: BaseRelation
|
self, from_relation: BaseRelation, to_relation: BaseRelation
|
||||||
) -> None:
|
) -> None:
|
||||||
if not isinstance(from_relation, self.Relation):
|
if not isinstance(from_relation, self.Relation):
|
||||||
raise MacroArgTypeError(
|
invalid_type_error(
|
||||||
method_name="expand_target_column_types",
|
method_name="expand_target_column_types",
|
||||||
arg_name="from_relation",
|
arg_name="from_relation",
|
||||||
got_value=from_relation,
|
got_value=from_relation,
|
||||||
@@ -681,7 +701,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not isinstance(to_relation, self.Relation):
|
if not isinstance(to_relation, self.Relation):
|
||||||
raise MacroArgTypeError(
|
invalid_type_error(
|
||||||
method_name="expand_target_column_types",
|
method_name="expand_target_column_types",
|
||||||
arg_name="to_relation",
|
arg_name="to_relation",
|
||||||
got_value=to_relation,
|
got_value=to_relation,
|
||||||
@@ -706,9 +726,9 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
relations = self.list_relations_without_caching(schema_relation)
|
relations = self.list_relations_without_caching(schema_relation)
|
||||||
fire_event(
|
fire_event(
|
||||||
ListRelations(
|
ListRelations(
|
||||||
database=cast_to_str(database),
|
database=database,
|
||||||
schema=schema,
|
schema=schema,
|
||||||
relations=[_make_ref_key_msg(x) for x in relations],
|
relations=[_make_key(x) for x in relations],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -763,7 +783,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
"schema": schema,
|
"schema": schema,
|
||||||
"database": database,
|
"database": database,
|
||||||
}
|
}
|
||||||
raise RelationReturnedMultipleResultsError(kwargs, matches)
|
get_relation_returned_multiple_results(kwargs, matches)
|
||||||
|
|
||||||
elif matches:
|
elif matches:
|
||||||
return matches[0]
|
return matches[0]
|
||||||
@@ -785,20 +805,20 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
@available.parse_none
|
@available.parse_none
|
||||||
def create_schema(self, relation: BaseRelation):
|
def create_schema(self, relation: BaseRelation):
|
||||||
"""Create the given schema if it does not exist."""
|
"""Create the given schema if it does not exist."""
|
||||||
raise NotImplementedError("`create_schema` is not implemented for this adapter!")
|
raise NotImplementedException("`create_schema` is not implemented for this adapter!")
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@available.parse_none
|
@available.parse_none
|
||||||
def drop_schema(self, relation: BaseRelation):
|
def drop_schema(self, relation: BaseRelation):
|
||||||
"""Drop the given schema (and everything in it) if it exists."""
|
"""Drop the given schema (and everything in it) if it exists."""
|
||||||
raise NotImplementedError("`drop_schema` is not implemented for this adapter!")
|
raise NotImplementedException("`drop_schema` is not implemented for this adapter!")
|
||||||
|
|
||||||
@available
|
@available
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def quote(cls, identifier: str) -> str:
|
def quote(cls, identifier: str) -> str:
|
||||||
"""Quote the given identifier, as appropriate for the database."""
|
"""Quote the given identifier, as appropriate for the database."""
|
||||||
raise NotImplementedError("`quote` is not implemented for this adapter!")
|
raise NotImplementedException("`quote` is not implemented for this adapter!")
|
||||||
|
|
||||||
@available
|
@available
|
||||||
def quote_as_configured(self, identifier: str, quote_key: str) -> str:
|
def quote_as_configured(self, identifier: str, quote_key: str) -> str:
|
||||||
@@ -827,7 +847,10 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
elif quote_config is None:
|
elif quote_config is None:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise QuoteConfigTypeError(quote_config)
|
raise_compiler_error(
|
||||||
|
f'The seed configuration value of "quote_columns" has an '
|
||||||
|
f"invalid type {type(quote_config)}"
|
||||||
|
)
|
||||||
|
|
||||||
if quote_columns:
|
if quote_columns:
|
||||||
return self.quote(column)
|
return self.quote(column)
|
||||||
@@ -848,7 +871,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param col_idx: The index into the agate table for the column.
|
:param col_idx: The index into the agate table for the column.
|
||||||
:return: The name of the type in the database
|
:return: The name of the type in the database
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`convert_text_type` is not implemented for this adapter!")
|
raise NotImplementedException("`convert_text_type` is not implemented for this adapter!")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -860,7 +883,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param col_idx: The index into the agate table for the column.
|
:param col_idx: The index into the agate table for the column.
|
||||||
:return: The name of the type in the database
|
:return: The name of the type in the database
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`convert_number_type` is not implemented for this adapter!")
|
raise NotImplementedException("`convert_number_type` is not implemented for this adapter!")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -872,7 +895,9 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param col_idx: The index into the agate table for the column.
|
:param col_idx: The index into the agate table for the column.
|
||||||
:return: The name of the type in the database
|
:return: The name of the type in the database
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`convert_boolean_type` is not implemented for this adapter!")
|
raise NotImplementedException(
|
||||||
|
"`convert_boolean_type` is not implemented for this adapter!"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -884,7 +909,9 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param col_idx: The index into the agate table for the column.
|
:param col_idx: The index into the agate table for the column.
|
||||||
:return: The name of the type in the database
|
:return: The name of the type in the database
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`convert_datetime_type` is not implemented for this adapter!")
|
raise NotImplementedException(
|
||||||
|
"`convert_datetime_type` is not implemented for this adapter!"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -896,7 +923,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param col_idx: The index into the agate table for the column.
|
:param col_idx: The index into the agate table for the column.
|
||||||
:return: The name of the type in the database
|
:return: The name of the type in the database
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`convert_date_type` is not implemented for this adapter!")
|
raise NotImplementedException("`convert_date_type` is not implemented for this adapter!")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -908,7 +935,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
:param col_idx: The index into the agate table for the column.
|
:param col_idx: The index into the agate table for the column.
|
||||||
:return: The name of the type in the database
|
:return: The name of the type in the database
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("`convert_time_type` is not implemented for this adapter!")
|
raise NotImplementedException("`convert_time_type` is not implemented for this adapter!")
|
||||||
|
|
||||||
@available
|
@available
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -975,7 +1002,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
else:
|
else:
|
||||||
package_name = 'the "{}" package'.format(project)
|
package_name = 'the "{}" package'.format(project)
|
||||||
|
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
'dbt could not find a macro with the name "{}" in {}'.format(
|
'dbt could not find a macro with the name "{}" in {}'.format(
|
||||||
macro_name, package_name
|
macro_name, package_name
|
||||||
)
|
)
|
||||||
@@ -1073,7 +1100,11 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
# now we have a 1-row table of the maximum `loaded_at_field` value and
|
# now we have a 1-row table of the maximum `loaded_at_field` value and
|
||||||
# the current time according to the db.
|
# the current time according to the db.
|
||||||
if len(table) != 1 or len(table[0]) != 2:
|
if len(table) != 1 or len(table[0]) != 2:
|
||||||
raise MacroResultError(FRESHNESS_MACRO_NAME, table)
|
raise_compiler_error(
|
||||||
|
'Got an invalid result from "{}" macro: {}'.format(
|
||||||
|
FRESHNESS_MACRO_NAME, [tuple(r) for r in table]
|
||||||
|
)
|
||||||
|
)
|
||||||
if table[0][0] is None:
|
if table[0][0] is None:
|
||||||
# no records in the table, so really the max_loaded_at was
|
# no records in the table, so really the max_loaded_at was
|
||||||
# infinitely long ago. Just call it 0:00 January 1 year UTC
|
# infinitely long ago. Just call it 0:00 January 1 year UTC
|
||||||
@@ -1150,7 +1181,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
elif location == "prepend":
|
elif location == "prepend":
|
||||||
return f"'{value}' || {add_to}"
|
return f"'{value}' || {add_to}"
|
||||||
else:
|
else:
|
||||||
raise DbtRuntimeError(f'Got an unexpected location value of "{location}"')
|
raise RuntimeException(f'Got an unexpected location value of "{location}"')
|
||||||
|
|
||||||
def get_rows_different_sql(
|
def get_rows_different_sql(
|
||||||
self,
|
self,
|
||||||
@@ -1189,6 +1220,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
def default_python_submission_method(self) -> str:
|
def default_python_submission_method(self) -> str:
|
||||||
raise NotImplementedError("default_python_submission_method is not specified")
|
raise NotImplementedError("default_python_submission_method is not specified")
|
||||||
|
|
||||||
|
@available.parse_none
|
||||||
@log_code_execution
|
@log_code_execution
|
||||||
def submit_python_job(self, parsed_model: dict, compiled_code: str) -> AdapterResponse:
|
def submit_python_job(self, parsed_model: dict, compiled_code: str) -> AdapterResponse:
|
||||||
submission_method = parsed_model["config"].get(
|
submission_method = parsed_model["config"].get(
|
||||||
@@ -1208,7 +1240,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
return self.generate_python_submission_response(submission_result)
|
return self.generate_python_submission_response(submission_result)
|
||||||
|
|
||||||
def generate_python_submission_response(self, submission_result: Any) -> AdapterResponse:
|
def generate_python_submission_response(self, submission_result: Any) -> AdapterResponse:
|
||||||
raise NotImplementedError(
|
raise NotImplementedException(
|
||||||
"Your adapter need to implement generate_python_submission_response"
|
"Your adapter need to implement generate_python_submission_response"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1232,7 +1264,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
valid_strategies.append("default")
|
valid_strategies.append("default")
|
||||||
builtin_strategies = self.builtin_incremental_strategies()
|
builtin_strategies = self.builtin_incremental_strategies()
|
||||||
if strategy in builtin_strategies and strategy not in valid_strategies:
|
if strategy in builtin_strategies and strategy not in valid_strategies:
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
f"The incremental strategy '{strategy}' is not valid for this adapter"
|
f"The incremental strategy '{strategy}' is not valid for this adapter"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1240,7 +1272,7 @@ class BaseAdapter(metaclass=AdapterMeta):
|
|||||||
macro_name = f"get_incremental_{strategy}_sql"
|
macro_name = f"get_incremental_{strategy}_sql"
|
||||||
# The model_context should have MacroGenerator callable objects for all macros
|
# The model_context should have MacroGenerator callable objects for all macros
|
||||||
if macro_name not in model_context:
|
if macro_name not in model_context:
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
'dbt could not find an incremental strategy macro with the name "{}" in {}'.format(
|
'dbt could not find an incremental strategy macro with the name "{}" in {}'.format(
|
||||||
macro_name, self.config.project_name
|
macro_name, self.config.project_name
|
||||||
)
|
)
|
||||||
@@ -1296,7 +1328,7 @@ def catch_as_completed(
|
|||||||
elif isinstance(exc, KeyboardInterrupt) or not isinstance(exc, Exception):
|
elif isinstance(exc, KeyboardInterrupt) or not isinstance(exc, Exception):
|
||||||
raise exc
|
raise exc
|
||||||
else:
|
else:
|
||||||
warn_or_error(CatalogGenerationError(exc=str(exc)))
|
warn_or_error(f"Encountered an error while generating catalog: {str(exc)}")
|
||||||
# exc is not None, derives from Exception, and isn't ctrl+c
|
# exc is not None, derives from Exception, and isn't ctrl+c
|
||||||
exceptions.append(exc)
|
exceptions.append(exc)
|
||||||
return merge_tables(tables), exceptions
|
return merge_tables(tables), exceptions
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from typing import List, Optional, Type
|
from typing import List, Optional, Type
|
||||||
|
|
||||||
from dbt.adapters.base import Credentials
|
from dbt.adapters.base import Credentials
|
||||||
from dbt.exceptions import CompilationError
|
from dbt.exceptions import CompilationException
|
||||||
from dbt.adapters.protocol import AdapterProtocol
|
from dbt.adapters.protocol import AdapterProtocol
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ def project_name_from_path(include_path: str) -> str:
|
|||||||
|
|
||||||
partial = Project.partial_load(include_path)
|
partial = Project.partial_load(include_path)
|
||||||
if partial.project_name is None:
|
if partial.project_name is None:
|
||||||
raise CompilationError(f"Invalid project at {include_path}: name not set!")
|
raise CompilationException(f"Invalid project at {include_path}: name not set!")
|
||||||
return partial.project_name
|
return partial.project_name
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ from dbt.clients.jinja import QueryStringGenerator
|
|||||||
|
|
||||||
from dbt.context.manifest import generate_query_header_context
|
from dbt.context.manifest import generate_query_header_context
|
||||||
from dbt.contracts.connection import AdapterRequiredConfig, QueryComment
|
from dbt.contracts.connection import AdapterRequiredConfig, QueryComment
|
||||||
from dbt.contracts.graph.nodes import ResultNode
|
from dbt.contracts.graph.compiled import CompileResultNode
|
||||||
from dbt.contracts.graph.manifest import Manifest
|
from dbt.contracts.graph.manifest import Manifest
|
||||||
from dbt.exceptions import DbtRuntimeError
|
from dbt.exceptions import RuntimeException
|
||||||
|
|
||||||
|
|
||||||
class NodeWrapper:
|
class NodeWrapper:
|
||||||
@@ -48,7 +48,7 @@ class _QueryComment(local):
|
|||||||
if isinstance(comment, str) and "*/" in comment:
|
if isinstance(comment, str) and "*/" in comment:
|
||||||
# tell the user "no" so they don't hurt themselves by writing
|
# tell the user "no" so they don't hurt themselves by writing
|
||||||
# garbage
|
# garbage
|
||||||
raise DbtRuntimeError(f'query comment contains illegal value "*/": {comment}')
|
raise RuntimeException(f'query comment contains illegal value "*/": {comment}')
|
||||||
self.query_comment = comment
|
self.query_comment = comment
|
||||||
self.append = append
|
self.append = append
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ class MacroQueryStringSetter:
|
|||||||
def reset(self):
|
def reset(self):
|
||||||
self.set("master", None)
|
self.set("master", None)
|
||||||
|
|
||||||
def set(self, name: str, node: Optional[ResultNode]):
|
def set(self, name: str, node: Optional[CompileResultNode]):
|
||||||
wrapped: Optional[NodeWrapper] = None
|
wrapped: Optional[NodeWrapper] = None
|
||||||
if node is not None:
|
if node is not None:
|
||||||
wrapped = NodeWrapper(node)
|
wrapped = NodeWrapper(node)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
from collections.abc import Hashable
|
from collections.abc import Hashable
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass
|
||||||
from typing import Optional, TypeVar, Any, Type, Dict, Iterator, Tuple, Set
|
from typing import Optional, TypeVar, Any, Type, Dict, Union, Iterator, Tuple, Set
|
||||||
|
|
||||||
from dbt.contracts.graph.nodes import SourceDefinition, ManifestNode, ResultNode, ParsedNode
|
from dbt.contracts.graph.compiled import CompiledNode
|
||||||
|
from dbt.contracts.graph.parsed import ParsedSourceDefinition, ParsedNode
|
||||||
from dbt.contracts.relation import (
|
from dbt.contracts.relation import (
|
||||||
RelationType,
|
RelationType,
|
||||||
ComponentName,
|
ComponentName,
|
||||||
@@ -11,11 +12,7 @@ from dbt.contracts.relation import (
|
|||||||
Policy,
|
Policy,
|
||||||
Path,
|
Path,
|
||||||
)
|
)
|
||||||
from dbt.exceptions import (
|
from dbt.exceptions import InternalException
|
||||||
ApproximateMatchError,
|
|
||||||
DbtInternalError,
|
|
||||||
MultipleDatabasesNotAllowedError,
|
|
||||||
)
|
|
||||||
from dbt.node_types import NodeType
|
from dbt.node_types import NodeType
|
||||||
from dbt.utils import filter_null_values, deep_merge, classproperty
|
from dbt.utils import filter_null_values, deep_merge, classproperty
|
||||||
|
|
||||||
@@ -30,10 +27,8 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
path: Path
|
path: Path
|
||||||
type: Optional[RelationType] = None
|
type: Optional[RelationType] = None
|
||||||
quote_character: str = '"'
|
quote_character: str = '"'
|
||||||
# Python 3.11 requires that these use default_factory instead of simple default
|
include_policy: Policy = Policy()
|
||||||
# ValueError: mutable default <class 'dbt.contracts.relation.Policy'> for field include_policy is not allowed: use default_factory
|
quote_policy: Policy = Policy()
|
||||||
include_policy: Policy = field(default_factory=lambda: Policy())
|
|
||||||
quote_policy: Policy = field(default_factory=lambda: Policy())
|
|
||||||
dbt_created: bool = False
|
dbt_created: bool = False
|
||||||
|
|
||||||
def _is_exactish_match(self, field: ComponentName, value: str) -> bool:
|
def _is_exactish_match(self, field: ComponentName, value: str) -> bool:
|
||||||
@@ -44,9 +39,9 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_field_named(cls, field_name):
|
def _get_field_named(cls, field_name):
|
||||||
for f, _ in cls._get_fields():
|
for field, _ in cls._get_fields():
|
||||||
if f.name == field_name:
|
if field.name == field_name:
|
||||||
return f
|
return field
|
||||||
# this should be unreachable
|
# this should be unreachable
|
||||||
raise ValueError(f"BaseRelation has no {field_name} field!")
|
raise ValueError(f"BaseRelation has no {field_name} field!")
|
||||||
|
|
||||||
@@ -57,11 +52,11 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_default_quote_policy(cls) -> Policy:
|
def get_default_quote_policy(cls) -> Policy:
|
||||||
return cls._get_field_named("quote_policy").default_factory()
|
return cls._get_field_named("quote_policy").default
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_default_include_policy(cls) -> Policy:
|
def get_default_include_policy(cls) -> Policy:
|
||||||
return cls._get_field_named("include_policy").default_factory()
|
return cls._get_field_named("include_policy").default
|
||||||
|
|
||||||
def get(self, key, default=None):
|
def get(self, key, default=None):
|
||||||
"""Override `.get` to return a metadata object so we don't break
|
"""Override `.get` to return a metadata object so we don't break
|
||||||
@@ -87,7 +82,7 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
|
|
||||||
if not search:
|
if not search:
|
||||||
# nothing was passed in
|
# nothing was passed in
|
||||||
raise dbt.exceptions.DbtRuntimeError(
|
raise dbt.exceptions.RuntimeException(
|
||||||
"Tried to match relation, but no search path was passed!"
|
"Tried to match relation, but no search path was passed!"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -104,7 +99,7 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
|
|
||||||
if approximate_match and not exact_match:
|
if approximate_match and not exact_match:
|
||||||
target = self.create(database=database, schema=schema, identifier=identifier)
|
target = self.create(database=database, schema=schema, identifier=identifier)
|
||||||
raise ApproximateMatchError(target, self)
|
dbt.exceptions.approximate_relation_match(target, self)
|
||||||
|
|
||||||
return exact_match
|
return exact_match
|
||||||
|
|
||||||
@@ -189,7 +184,7 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_from_source(cls: Type[Self], source: SourceDefinition, **kwargs: Any) -> Self:
|
def create_from_source(cls: Type[Self], source: ParsedSourceDefinition, **kwargs: Any) -> Self:
|
||||||
source_quoting = source.quoting.to_dict(omit_none=True)
|
source_quoting = source.quoting.to_dict(omit_none=True)
|
||||||
source_quoting.pop("column", None)
|
source_quoting.pop("column", None)
|
||||||
quote_policy = deep_merge(
|
quote_policy = deep_merge(
|
||||||
@@ -214,7 +209,7 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
def create_ephemeral_from_node(
|
def create_ephemeral_from_node(
|
||||||
cls: Type[Self],
|
cls: Type[Self],
|
||||||
config: HasQuoting,
|
config: HasQuoting,
|
||||||
node: ManifestNode,
|
node: Union[ParsedNode, CompiledNode],
|
||||||
) -> Self:
|
) -> Self:
|
||||||
# Note that ephemeral models are based on the name.
|
# Note that ephemeral models are based on the name.
|
||||||
identifier = cls.add_ephemeral_prefix(node.name)
|
identifier = cls.add_ephemeral_prefix(node.name)
|
||||||
@@ -227,7 +222,7 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
def create_from_node(
|
def create_from_node(
|
||||||
cls: Type[Self],
|
cls: Type[Self],
|
||||||
config: HasQuoting,
|
config: HasQuoting,
|
||||||
node: ManifestNode,
|
node: Union[ParsedNode, CompiledNode],
|
||||||
quote_policy: Optional[Dict[str, bool]] = None,
|
quote_policy: Optional[Dict[str, bool]] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Self:
|
) -> Self:
|
||||||
@@ -248,20 +243,20 @@ class BaseRelation(FakeAPIObject, Hashable):
|
|||||||
def create_from(
|
def create_from(
|
||||||
cls: Type[Self],
|
cls: Type[Self],
|
||||||
config: HasQuoting,
|
config: HasQuoting,
|
||||||
node: ResultNode,
|
node: Union[CompiledNode, ParsedNode, ParsedSourceDefinition],
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Self:
|
) -> Self:
|
||||||
if node.resource_type == NodeType.Source:
|
if node.resource_type == NodeType.Source:
|
||||||
if not isinstance(node, SourceDefinition):
|
if not isinstance(node, ParsedSourceDefinition):
|
||||||
raise DbtInternalError(
|
raise InternalException(
|
||||||
"type mismatch, expected SourceDefinition but got {}".format(type(node))
|
"type mismatch, expected ParsedSourceDefinition but got {}".format(type(node))
|
||||||
)
|
)
|
||||||
return cls.create_from_source(node, **kwargs)
|
return cls.create_from_source(node, **kwargs)
|
||||||
else:
|
else:
|
||||||
# Can't use ManifestNode here because of parameterized generics
|
if not isinstance(node, (ParsedNode, CompiledNode)):
|
||||||
if not isinstance(node, (ParsedNode)):
|
raise InternalException(
|
||||||
raise DbtInternalError(
|
"type mismatch, expected ParsedNode or CompiledNode but "
|
||||||
f"type mismatch, expected ManifestNode but got {type(node)}"
|
"got {}".format(type(node))
|
||||||
)
|
)
|
||||||
return cls.create_from_node(config, node, **kwargs)
|
return cls.create_from_node(config, node, **kwargs)
|
||||||
|
|
||||||
@@ -358,7 +353,7 @@ class InformationSchema(BaseRelation):
|
|||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
if not isinstance(self.information_schema_view, (type(None), str)):
|
if not isinstance(self.information_schema_view, (type(None), str)):
|
||||||
raise dbt.exceptions.CompilationError(
|
raise dbt.exceptions.CompilationException(
|
||||||
"Got an invalid name: {}".format(self.information_schema_view)
|
"Got an invalid name: {}".format(self.information_schema_view)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -442,7 +437,7 @@ class SchemaSearchMap(Dict[InformationSchema, Set[Optional[str]]]):
|
|||||||
if not allow_multiple_databases:
|
if not allow_multiple_databases:
|
||||||
seen = {r.database.lower() for r in self if r.database}
|
seen = {r.database.lower() for r in self if r.database}
|
||||||
if len(seen) > 1:
|
if len(seen) > 1:
|
||||||
raise MultipleDatabasesNotAllowedError(seen)
|
dbt.exceptions.raise_compiler_error(str(seen))
|
||||||
|
|
||||||
for information_schema_name, schema in self.search():
|
for information_schema_name, schema in self.search():
|
||||||
path = {"database": information_schema_name.database, "schema": schema}
|
path = {"database": information_schema_name.database, "schema": schema}
|
||||||
|
|||||||
@@ -1,24 +1,28 @@
|
|||||||
|
import re
|
||||||
import threading
|
import threading
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
|
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
|
||||||
|
|
||||||
from dbt.adapters.reference_keys import (
|
from dbt.adapters.reference_keys import _make_key, _ReferenceKey
|
||||||
_make_ref_key,
|
import dbt.exceptions
|
||||||
_make_ref_key_msg,
|
from dbt.events.functions import fire_event
|
||||||
_make_msg_from_ref_key,
|
from dbt.events.types import (
|
||||||
_ReferenceKey,
|
AddLink,
|
||||||
|
AddRelation,
|
||||||
|
DropCascade,
|
||||||
|
DropMissingRelation,
|
||||||
|
DropRelation,
|
||||||
|
DumpAfterAddGraph,
|
||||||
|
DumpAfterRenameSchema,
|
||||||
|
DumpBeforeAddGraph,
|
||||||
|
DumpBeforeRenameSchema,
|
||||||
|
RenameSchema,
|
||||||
|
TemporaryRelation,
|
||||||
|
UncachedRelation,
|
||||||
|
UpdateReference,
|
||||||
)
|
)
|
||||||
from dbt.exceptions import (
|
|
||||||
DependentLinkNotCachedError,
|
|
||||||
NewNameAlreadyInCacheError,
|
|
||||||
NoneRelationFoundError,
|
|
||||||
ReferencedLinkNotCachedError,
|
|
||||||
TruncatedModelNameCausedCollisionError,
|
|
||||||
)
|
|
||||||
from dbt.events.functions import fire_event, fire_event_if
|
|
||||||
from dbt.events.types import CacheAction, CacheDumpGraph
|
|
||||||
import dbt.flags as flags
|
|
||||||
from dbt.utils import lowercase
|
from dbt.utils import lowercase
|
||||||
|
from dbt.helper_types import Lazy
|
||||||
|
|
||||||
|
|
||||||
def dot_separated(key: _ReferenceKey) -> str:
|
def dot_separated(key: _ReferenceKey) -> str:
|
||||||
@@ -78,7 +82,7 @@ class _CachedRelation:
|
|||||||
|
|
||||||
:return _ReferenceKey: A key for this relation.
|
:return _ReferenceKey: A key for this relation.
|
||||||
"""
|
"""
|
||||||
return _make_ref_key(self)
|
return _make_key(self)
|
||||||
|
|
||||||
def add_reference(self, referrer: "_CachedRelation"):
|
def add_reference(self, referrer: "_CachedRelation"):
|
||||||
"""Add a reference from referrer to self, indicating that if this node
|
"""Add a reference from referrer to self, indicating that if this node
|
||||||
@@ -141,7 +145,11 @@ class _CachedRelation:
|
|||||||
:raises InternalError: If the new key already exists.
|
:raises InternalError: If the new key already exists.
|
||||||
"""
|
"""
|
||||||
if new_key in self.referenced_by:
|
if new_key in self.referenced_by:
|
||||||
raise NewNameAlreadyInCacheError(old_key, new_key)
|
dbt.exceptions.raise_cache_inconsistent(
|
||||||
|
'in rename of "{}" -> "{}", new name is in the cache already'.format(
|
||||||
|
old_key, new_key
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if old_key not in self.referenced_by:
|
if old_key not in self.referenced_by:
|
||||||
return
|
return
|
||||||
@@ -257,17 +265,21 @@ class RelationsCache:
|
|||||||
if referenced is None:
|
if referenced is None:
|
||||||
return
|
return
|
||||||
if referenced is None:
|
if referenced is None:
|
||||||
raise ReferencedLinkNotCachedError(referenced_key)
|
dbt.exceptions.raise_cache_inconsistent(
|
||||||
|
"in add_link, referenced link key {} not in cache!".format(referenced_key)
|
||||||
|
)
|
||||||
|
|
||||||
dependent = self.relations.get(dependent_key)
|
dependent = self.relations.get(dependent_key)
|
||||||
if dependent is None:
|
if dependent is None:
|
||||||
raise DependentLinkNotCachedError(dependent_key)
|
dbt.exceptions.raise_cache_inconsistent(
|
||||||
|
"in add_link, dependent link key {} not in cache!".format(dependent_key)
|
||||||
|
)
|
||||||
|
|
||||||
assert dependent is not None # we just raised!
|
assert dependent is not None # we just raised!
|
||||||
|
|
||||||
referenced.add_reference(dependent)
|
referenced.add_reference(dependent)
|
||||||
|
|
||||||
# This is called in plugins/postgres/dbt/adapters/postgres/impl.py
|
# TODO: Is this dead code? I can't seem to find it grepping the codebase.
|
||||||
def add_link(self, referenced, dependent):
|
def add_link(self, referenced, dependent):
|
||||||
"""Add a link between two relations to the database. If either relation
|
"""Add a link between two relations to the database. If either relation
|
||||||
does not exist, it will be added as an "external" relation.
|
does not exist, it will be added as an "external" relation.
|
||||||
@@ -282,18 +294,13 @@ class RelationsCache:
|
|||||||
:param BaseRelation dependent: The dependent model.
|
:param BaseRelation dependent: The dependent model.
|
||||||
:raises InternalError: If either entry does not exist.
|
:raises InternalError: If either entry does not exist.
|
||||||
"""
|
"""
|
||||||
ref_key = _make_ref_key(referenced)
|
ref_key = _make_key(referenced)
|
||||||
dep_key = _make_ref_key(dependent)
|
dep_key = _make_key(dependent)
|
||||||
if (ref_key.database, ref_key.schema) not in self:
|
if (ref_key.database, ref_key.schema) not in self:
|
||||||
# if we have not cached the referenced schema at all, we must be
|
# if we have not cached the referenced schema at all, we must be
|
||||||
# referring to a table outside our control. There's no need to make
|
# referring to a table outside our control. There's no need to make
|
||||||
# a link - we will never drop the referenced relation during a run.
|
# a link - we will never drop the referenced relation during a run.
|
||||||
fire_event(
|
fire_event(UncachedRelation(dep_key=dep_key, ref_key=ref_key))
|
||||||
CacheAction(
|
|
||||||
ref_key=_make_msg_from_ref_key(ref_key),
|
|
||||||
ref_key_2=_make_msg_from_ref_key(dep_key),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
if ref_key not in self.relations:
|
if ref_key not in self.relations:
|
||||||
# Insert a dummy "external" relation.
|
# Insert a dummy "external" relation.
|
||||||
@@ -303,13 +310,7 @@ class RelationsCache:
|
|||||||
# Insert a dummy "external" relation.
|
# Insert a dummy "external" relation.
|
||||||
dependent = dependent.replace(type=referenced.External)
|
dependent = dependent.replace(type=referenced.External)
|
||||||
self.add(dependent)
|
self.add(dependent)
|
||||||
fire_event(
|
fire_event(AddLink(dep_key=dep_key, ref_key=ref_key))
|
||||||
CacheAction(
|
|
||||||
action="add_link",
|
|
||||||
ref_key=_make_msg_from_ref_key(dep_key),
|
|
||||||
ref_key_2=_make_msg_from_ref_key(ref_key),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self._add_link(ref_key, dep_key)
|
self._add_link(ref_key, dep_key)
|
||||||
|
|
||||||
@@ -320,18 +321,12 @@ class RelationsCache:
|
|||||||
:param BaseRelation relation: The underlying relation.
|
:param BaseRelation relation: The underlying relation.
|
||||||
"""
|
"""
|
||||||
cached = _CachedRelation(relation)
|
cached = _CachedRelation(relation)
|
||||||
fire_event_if(
|
fire_event(AddRelation(relation=_make_key(cached)))
|
||||||
flags.LOG_CACHE_EVENTS,
|
fire_event(DumpBeforeAddGraph(dump=Lazy.defer(lambda: self.dump_graph())))
|
||||||
lambda: CacheDumpGraph(before_after="before", action="adding", dump=self.dump_graph()),
|
|
||||||
)
|
|
||||||
fire_event(CacheAction(action="add_relation", ref_key=_make_ref_key_msg(cached)))
|
|
||||||
|
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self._setdefault(cached)
|
self._setdefault(cached)
|
||||||
fire_event_if(
|
fire_event(DumpAfterAddGraph(dump=Lazy.defer(lambda: self.dump_graph())))
|
||||||
flags.LOG_CACHE_EVENTS,
|
|
||||||
lambda: CacheDumpGraph(before_after="after", action="adding", dump=self.dump_graph()),
|
|
||||||
)
|
|
||||||
|
|
||||||
def _remove_refs(self, keys):
|
def _remove_refs(self, keys):
|
||||||
"""Removes all references to all entries in keys. This does not
|
"""Removes all references to all entries in keys. This does not
|
||||||
@@ -346,6 +341,19 @@ class RelationsCache:
|
|||||||
for cached in self.relations.values():
|
for cached in self.relations.values():
|
||||||
cached.release_references(keys)
|
cached.release_references(keys)
|
||||||
|
|
||||||
|
def _drop_cascade_relation(self, dropped_key):
|
||||||
|
"""Drop the given relation and cascade it appropriately to all
|
||||||
|
dependent relations.
|
||||||
|
|
||||||
|
:param _CachedRelation dropped: An existing _CachedRelation to drop.
|
||||||
|
"""
|
||||||
|
if dropped_key not in self.relations:
|
||||||
|
fire_event(DropMissingRelation(relation=dropped_key))
|
||||||
|
return
|
||||||
|
consequences = self.relations[dropped_key].collect_consequences()
|
||||||
|
fire_event(DropCascade(dropped=dropped_key, consequences=consequences))
|
||||||
|
self._remove_refs(consequences)
|
||||||
|
|
||||||
def drop(self, relation):
|
def drop(self, relation):
|
||||||
"""Drop the named relation and cascade it appropriately to all
|
"""Drop the named relation and cascade it appropriately to all
|
||||||
dependent relations.
|
dependent relations.
|
||||||
@@ -357,22 +365,10 @@ class RelationsCache:
|
|||||||
:param str schema: The schema of the relation to drop.
|
:param str schema: The schema of the relation to drop.
|
||||||
:param str identifier: The identifier of the relation to drop.
|
:param str identifier: The identifier of the relation to drop.
|
||||||
"""
|
"""
|
||||||
dropped_key = _make_ref_key(relation)
|
dropped_key = _make_key(relation)
|
||||||
dropped_key_msg = _make_ref_key_msg(relation)
|
fire_event(DropRelation(dropped=dropped_key))
|
||||||
fire_event(CacheAction(action="drop_relation", ref_key=dropped_key_msg))
|
|
||||||
with self.lock:
|
with self.lock:
|
||||||
if dropped_key not in self.relations:
|
self._drop_cascade_relation(dropped_key)
|
||||||
fire_event(CacheAction(action="drop_missing_relation", ref_key=dropped_key_msg))
|
|
||||||
return
|
|
||||||
consequences = self.relations[dropped_key].collect_consequences()
|
|
||||||
# convert from a list of _ReferenceKeys to a list of ReferenceKeyMsgs
|
|
||||||
consequence_msgs = [_make_msg_from_ref_key(key) for key in consequences]
|
|
||||||
fire_event(
|
|
||||||
CacheAction(
|
|
||||||
action="drop_cascade", ref_key=dropped_key_msg, ref_list=consequence_msgs
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self._remove_refs(consequences)
|
|
||||||
|
|
||||||
def _rename_relation(self, old_key, new_relation):
|
def _rename_relation(self, old_key, new_relation):
|
||||||
"""Rename a relation named old_key to new_key, updating references.
|
"""Rename a relation named old_key to new_key, updating references.
|
||||||
@@ -388,20 +384,14 @@ class RelationsCache:
|
|||||||
relation = self.relations.pop(old_key)
|
relation = self.relations.pop(old_key)
|
||||||
new_key = new_relation.key()
|
new_key = new_relation.key()
|
||||||
|
|
||||||
# relation has to rename its innards, so it needs the _CachedRelation.
|
# relaton has to rename its innards, so it needs the _CachedRelation.
|
||||||
relation.rename(new_relation)
|
relation.rename(new_relation)
|
||||||
# update all the relations that refer to it
|
# update all the relations that refer to it
|
||||||
for cached in self.relations.values():
|
for cached in self.relations.values():
|
||||||
if cached.is_referenced_by(old_key):
|
if cached.is_referenced_by(old_key):
|
||||||
fire_event(
|
fire_event(
|
||||||
CacheAction(
|
UpdateReference(old_key=old_key, new_key=new_key, cached_key=cached.key())
|
||||||
action="update_reference",
|
|
||||||
ref_key=_make_ref_key_msg(old_key),
|
|
||||||
ref_key_2=_make_ref_key_msg(new_key),
|
|
||||||
ref_key_3=_make_ref_key_msg(cached.key()),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cached.rename_key(old_key, new_key)
|
cached.rename_key(old_key, new_key)
|
||||||
|
|
||||||
self.relations[new_key] = relation
|
self.relations[new_key] = relation
|
||||||
@@ -426,12 +416,27 @@ class RelationsCache:
|
|||||||
if new_key in self.relations:
|
if new_key in self.relations:
|
||||||
# Tell user when collision caused by model names truncated during
|
# Tell user when collision caused by model names truncated during
|
||||||
# materialization.
|
# materialization.
|
||||||
raise TruncatedModelNameCausedCollisionError(new_key, self.relations)
|
match = re.search("__dbt_backup|__dbt_tmp$", new_key.identifier)
|
||||||
|
if match:
|
||||||
|
truncated_model_name_prefix = new_key.identifier[: match.start()]
|
||||||
|
message_addendum = (
|
||||||
|
"\n\nName collisions can occur when the length of two "
|
||||||
|
"models' names approach your database's builtin limit. "
|
||||||
|
"Try restructuring your project such that no two models "
|
||||||
|
"share the prefix '{}'.".format(truncated_model_name_prefix)
|
||||||
|
+ " Then, clean your warehouse of any removed models."
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
message_addendum = ""
|
||||||
|
|
||||||
|
dbt.exceptions.raise_cache_inconsistent(
|
||||||
|
"in rename, new key {} already in cache: {}{}".format(
|
||||||
|
new_key, list(self.relations.keys()), message_addendum
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if old_key not in self.relations:
|
if old_key not in self.relations:
|
||||||
fire_event(
|
fire_event(TemporaryRelation(key=old_key))
|
||||||
CacheAction(action="temporary_relation", ref_key=_make_msg_from_ref_key(old_key))
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -447,20 +452,11 @@ class RelationsCache:
|
|||||||
:param BaseRelation new: The new relation name information.
|
:param BaseRelation new: The new relation name information.
|
||||||
:raises InternalError: If the new key is already present.
|
:raises InternalError: If the new key is already present.
|
||||||
"""
|
"""
|
||||||
old_key = _make_ref_key(old)
|
old_key = _make_key(old)
|
||||||
new_key = _make_ref_key(new)
|
new_key = _make_key(new)
|
||||||
fire_event(
|
fire_event(RenameSchema(old_key=old_key, new_key=new_key))
|
||||||
CacheAction(
|
|
||||||
action="rename_relation",
|
|
||||||
ref_key=_make_msg_from_ref_key(old_key),
|
|
||||||
ref_key_2=_make_msg_from_ref_key(new),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
fire_event_if(
|
fire_event(DumpBeforeRenameSchema(dump=Lazy.defer(lambda: self.dump_graph())))
|
||||||
flags.LOG_CACHE_EVENTS,
|
|
||||||
lambda: CacheDumpGraph(before_after="before", action="rename", dump=self.dump_graph()),
|
|
||||||
)
|
|
||||||
|
|
||||||
with self.lock:
|
with self.lock:
|
||||||
if self._check_rename_constraints(old_key, new_key):
|
if self._check_rename_constraints(old_key, new_key):
|
||||||
@@ -468,10 +464,7 @@ class RelationsCache:
|
|||||||
else:
|
else:
|
||||||
self._setdefault(_CachedRelation(new))
|
self._setdefault(_CachedRelation(new))
|
||||||
|
|
||||||
fire_event_if(
|
fire_event(DumpAfterRenameSchema(dump=Lazy.defer(lambda: self.dump_graph())))
|
||||||
flags.LOG_CACHE_EVENTS,
|
|
||||||
lambda: CacheDumpGraph(before_after="after", action="rename", dump=self.dump_graph()),
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_relations(self, database: Optional[str], schema: Optional[str]) -> List[Any]:
|
def get_relations(self, database: Optional[str], schema: Optional[str]) -> List[Any]:
|
||||||
"""Case-insensitively yield all relations matching the given schema.
|
"""Case-insensitively yield all relations matching the given schema.
|
||||||
@@ -490,7 +483,9 @@ class RelationsCache:
|
|||||||
]
|
]
|
||||||
|
|
||||||
if None in results:
|
if None in results:
|
||||||
raise NoneRelationFoundError()
|
dbt.exceptions.raise_cache_inconsistent(
|
||||||
|
"in get_relations, a None relation was found in the cache!"
|
||||||
|
)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
@@ -517,6 +512,6 @@ class RelationsCache:
|
|||||||
"""
|
"""
|
||||||
for relation in to_remove:
|
for relation in to_remove:
|
||||||
# it may have been cascaded out already
|
# it may have been cascaded out already
|
||||||
drop_key = _make_ref_key(relation)
|
drop_key = _make_key(relation)
|
||||||
if drop_key in self.relations:
|
if drop_key in self.relations:
|
||||||
self.drop(drop_key)
|
self.drop(drop_key)
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
import threading
|
import threading
|
||||||
import traceback
|
|
||||||
from contextlib import contextmanager
|
|
||||||
from importlib import import_module
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Set, Type
|
from importlib import import_module
|
||||||
|
from typing import Type, Dict, Any, List, Optional, Set
|
||||||
|
|
||||||
from dbt.adapters.base.plugin import AdapterPlugin
|
from dbt.exceptions import RuntimeException, InternalException
|
||||||
from dbt.adapters.protocol import AdapterConfig, AdapterProtocol, RelationProtocol
|
from dbt.include.global_project import (
|
||||||
from dbt.contracts.connection import AdapterRequiredConfig, Credentials
|
PACKAGE_PATH as GLOBAL_PROJECT_PATH,
|
||||||
|
PROJECT_NAME as GLOBAL_PROJECT_NAME,
|
||||||
|
)
|
||||||
from dbt.events.functions import fire_event
|
from dbt.events.functions import fire_event
|
||||||
from dbt.events.types import AdapterImportError, PluginLoadError
|
from dbt.events.types import AdapterImportError, PluginLoadError
|
||||||
from dbt.exceptions import DbtInternalError, DbtRuntimeError
|
from dbt.contracts.connection import Credentials, AdapterRequiredConfig
|
||||||
from dbt.include.global_project import PACKAGE_PATH as GLOBAL_PROJECT_PATH
|
from dbt.adapters.protocol import (
|
||||||
from dbt.include.global_project import PROJECT_NAME as GLOBAL_PROJECT_NAME
|
AdapterProtocol,
|
||||||
|
AdapterConfig,
|
||||||
|
RelationProtocol,
|
||||||
|
)
|
||||||
|
from dbt.adapters.base.plugin import AdapterPlugin
|
||||||
|
|
||||||
|
|
||||||
Adapter = AdapterProtocol
|
Adapter = AdapterProtocol
|
||||||
|
|
||||||
@@ -34,7 +39,7 @@ class AdapterContainer:
|
|||||||
names = ", ".join(self.plugins.keys())
|
names = ", ".join(self.plugins.keys())
|
||||||
|
|
||||||
message = f"Invalid adapter type {name}! Must be one of {names}"
|
message = f"Invalid adapter type {name}! Must be one of {names}"
|
||||||
raise DbtRuntimeError(message)
|
raise RuntimeException(message)
|
||||||
|
|
||||||
def get_adapter_class_by_name(self, name: str) -> Type[Adapter]:
|
def get_adapter_class_by_name(self, name: str) -> Type[Adapter]:
|
||||||
plugin = self.get_plugin_by_name(name)
|
plugin = self.get_plugin_by_name(name)
|
||||||
@@ -59,18 +64,18 @@ class AdapterContainer:
|
|||||||
# if we failed to import the target module in particular, inform
|
# if we failed to import the target module in particular, inform
|
||||||
# the user about it via a runtime error
|
# the user about it via a runtime error
|
||||||
if exc.name == "dbt.adapters." + name:
|
if exc.name == "dbt.adapters." + name:
|
||||||
fire_event(AdapterImportError(exc=str(exc)))
|
fire_event(AdapterImportError(exc=exc))
|
||||||
raise DbtRuntimeError(f"Could not find adapter type {name}!")
|
raise RuntimeException(f"Could not find adapter type {name}!")
|
||||||
# otherwise, the error had to have come from some underlying
|
# otherwise, the error had to have come from some underlying
|
||||||
# library. Log the stack trace.
|
# library. Log the stack trace.
|
||||||
|
|
||||||
fire_event(PluginLoadError(exc_info=traceback.format_exc()))
|
fire_event(PluginLoadError())
|
||||||
raise
|
raise
|
||||||
plugin: AdapterPlugin = mod.Plugin
|
plugin: AdapterPlugin = mod.Plugin
|
||||||
plugin_type = plugin.adapter.type()
|
plugin_type = plugin.adapter.type()
|
||||||
|
|
||||||
if plugin_type != name:
|
if plugin_type != name:
|
||||||
raise DbtRuntimeError(
|
raise RuntimeException(
|
||||||
f"Expected to find adapter with type named {name}, got "
|
f"Expected to find adapter with type named {name}, got "
|
||||||
f"adapter with type {plugin_type}"
|
f"adapter with type {plugin_type}"
|
||||||
)
|
)
|
||||||
@@ -132,7 +137,7 @@ class AdapterContainer:
|
|||||||
try:
|
try:
|
||||||
plugin = self.plugins[plugin_name]
|
plugin = self.plugins[plugin_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise DbtInternalError(f"No plugin found for {plugin_name}") from None
|
raise InternalException(f"No plugin found for {plugin_name}") from None
|
||||||
plugins.append(plugin)
|
plugins.append(plugin)
|
||||||
seen.add(plugin_name)
|
seen.add(plugin_name)
|
||||||
for dep in plugin.dependencies:
|
for dep in plugin.dependencies:
|
||||||
@@ -151,7 +156,7 @@ class AdapterContainer:
|
|||||||
try:
|
try:
|
||||||
path = self.packages[package_name]
|
path = self.packages[package_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise DbtInternalError(f"No internal package listing found for {package_name}")
|
raise InternalException(f"No internal package listing found for {package_name}")
|
||||||
paths.append(path)
|
paths.append(path)
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
@@ -212,12 +217,3 @@ def get_adapter_package_names(name: Optional[str]) -> List[str]:
|
|||||||
|
|
||||||
def get_adapter_type_names(name: Optional[str]) -> List[str]:
|
def get_adapter_type_names(name: Optional[str]) -> List[str]:
|
||||||
return FACTORY.get_adapter_type_names(name)
|
return FACTORY.get_adapter_type_names(name)
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
|
||||||
def adapter_management():
|
|
||||||
reset_adapters()
|
|
||||||
try:
|
|
||||||
yield
|
|
||||||
finally:
|
|
||||||
cleanup_connections()
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user