Compare commits

..

29 Commits

Author SHA1 Message Date
Github Build Bot
4e9e9b595a Add automated changelog yaml from template for bot PR 2022-08-02 15:18:35 +00:00
Github Build Bot
07c05df7d4 Add automated changelog yaml from template for bot PR 2022-08-02 15:15:53 +00:00
Emily Rockman
8fcd76d579 Merge branch 'emmyoop-patch-1' of https://github.com/dbt-labs/dbt-core into emmyoop-patch-1 2022-08-02 10:14:46 -05:00
Emily Rockman
3d594f79ca add cl 2022-08-02 10:14:17 -05:00
Emily Rockman
9aedcfb06e Delete Fixes-20220801-141122.yaml 2022-08-02 10:05:39 -05:00
Emily Rockman
00ae7f02ba catchup 2022-08-02 09:51:25 -05:00
Emily Rockman
b6534926c0 rename file 2022-08-02 09:48:32 -05:00
Emily Rockman
5b97ca7699 remove token 2022-08-02 09:09:36 -05:00
Emily Rockman
ef59ac3f57 Merge branch 'main' of https://github.com/dbt-labs/dbt-core into er/ct-872-resusable-changie 2022-08-02 09:08:11 -05:00
Emily Rockman
81122e22fe remove dummy changelog 2022-08-02 09:07:52 -05:00
Emily Rockman
053c995944 add checkout 2022-08-01 14:55:19 -05:00
Emily Rockman
9cc4a72e5e change label env 2022-08-01 14:53:07 -05:00
Emily Rockman
72f3b3d8d0 brute force it 2022-08-01 14:50:43 -05:00
Emily Rockman
b86b59233b inherit secrets 2022-08-01 14:44:48 -05:00
Github Build Bot
e58de6fa75 Add automated changelog yaml from template for bot PR 2022-08-01 19:39:21 +00:00
Emily Rockman
a56cbe6e5c Delete Dependency-20220801-193810.yaml 2022-08-01 14:38:35 -05:00
Github Build Bot
17e27de313 Add automated changelog yaml from template for bot PR 2022-08-01 19:38:16 +00:00
Emily Rockman
d772c39a13 Merge branch 'er/ct-872-resusable-changie' of https://github.com/dbt-labs/dbt-core into emmyoop-patch-1 2022-08-01 14:27:05 -05:00
Emily Rockman
b25a55c4df specify GITHUB_TOKEN 2022-08-01 14:25:23 -05:00
Emily Rockman
6c5c0213e5 changelog 2022-08-01 14:11:39 -05:00
Emily Rockman
7106110eea Update CONTRIBUTING.md 2022-08-01 10:27:52 -05:00
Emily Rockman
c23482a2de send in comment/label 2022-07-27 15:22:19 -05:00
Emily Rockman
3bf9b99f92 inherit secrets 2022-07-27 14:38:41 -05:00
Emily Rockman
95642a13e1 move def 2022-07-27 14:35:25 -05:00
Emily Rockman
3f518dc5aa fix typo 2022-07-27 14:32:09 -05:00
Emily Rockman
d803b29a76 update to use workflow 2022-07-27 14:29:34 -05:00
Emily Rockman
51bccde0ab reimplemented changelog 2022-07-27 14:06:47 -05:00
Emily Rockman
3fa193d83b fix branch name 2022-07-27 13:55:46 -05:00
Emily Rockman
dad919041a convert to reusable action 2022-07-27 13:51:03 -05:00
675 changed files with 12048 additions and 52857 deletions

View File

@@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 1.4.0a1 current_version = 1.3.0b1
parse = (?P<major>\d+) parse = (?P<major>\d+)
\.(?P<minor>\d+) \.(?P<minor>\d+)
\.(?P<patch>\d+) \.(?P<patch>\d+)

View File

@@ -3,7 +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.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
View 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))

View 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"

View 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"

View 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"

View 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: "5574"
PR: "5577"

View 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: "5574"
PR: "5577"

View 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: "5574"
PR: "5577"

View 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: "5574"
PR: "5577"

View 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: "5574"
PR: "5577"

View 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: "5574"
PR: "5577"

View 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: "5574"
PR: "5577"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View File

@@ -0,0 +1,7 @@
kind: Breaking Changes
body: changelogs!
time: 2022-08-02T10:14:06.122483-05:00
custom:
Author: emmyoop
Issue: "123"
PR: "345"

View File

@@ -0,0 +1,8 @@
kind: Dependency
body: "DRAFT - ignore"
time: 2022-08-02T15:15:49.00000Z
custom:
Author: emmyoop
Issue: 4904
PR: 5588

View File

@@ -0,0 +1,8 @@
kind: Dependency
body: "DRAFT - ignore"
time: 2022-08-02T15:18:31.00000Z
custom:
Author: emmyoop
Issue: 4904
PR: 5588

View File

@@ -1,7 +0,0 @@
kind: "Dependency"
body: "Update pathspec requirement from ~=0.9.0 to >=0.9,<0.11 in /core"
time: 2022-09-23T00:06:46.00000Z
custom:
Author: dependabot[bot]
Issue: 4904
PR: 5917

View File

@@ -1,7 +0,0 @@
kind: "Dependency"
body: "Bump black from 22.8.0 to 22.10.0"
time: 2022-10-07T00:08:48.00000Z
custom:
Author: dependabot[bot]
Issue: 4904
PR: 6019

View File

@@ -1,7 +0,0 @@
kind: "Dependency"
body: "Bump mashumaro[msgpack] from 3.0.4 to 3.1.1 in /core"
time: 2022-10-20T00:07:53.00000Z
custom:
Author: dependabot[bot]
Issue: 4904
PR: 6108

View File

@@ -1,7 +0,0 @@
kind: "Dependency"
body: "Update colorama requirement from <0.4.6,>=0.3.9 to >=0.3.9,<0.4.7 in /core"
time: 2022-10-26T00:09:10.00000Z
custom:
Author: dependabot[bot]
Issue: 4904
PR: 6144

View File

@@ -1,7 +0,0 @@
kind: Docs
body: minor doc correction
time: 2022-09-08T15:41:57.689162-04:00
custom:
Author: andy-clapson
Issue: "5791"
PR: "5684"

View File

@@ -1,7 +0,0 @@
kind: Docs
body: Generate API docs for new CLI interface
time: 2022-10-07T09:06:56.446078-05:00
custom:
Author: stu-k
Issue: "5528"
PR: "6022"

View File

@@ -1,6 +0,0 @@
kind: Docs
time: 2022-10-17T17:14:11.715348-05:00
custom:
Author: paulbenschmidt
Issue: "5880"
PR: "324"

View File

@@ -1,7 +0,0 @@
kind: Docs
body: Fix rendering of sample code for metrics
time: 2022-11-16T15:57:43.204201+01:00
custom:
Author: jtcohen6
Issue: "323"
PR: "346"

View 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"

View File

@@ -1,8 +0,0 @@
kind: Features
body: Added favor-state flag to optionally favor state nodes even if unselected node
exists
time: 2022-04-08T16:54:59.696564+01:00
custom:
Author: daniel-murray josephberni
Issue: "2968"
PR: "5859"

View 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"

View File

@@ -1,7 +0,0 @@
kind: Features
body: Proto logging messages
time: 2022-08-17T15:48:57.225267-04:00
custom:
Author: gshank
Issue: "5610"
PR: "5643"

View File

@@ -1,7 +0,0 @@
kind: Features
body: Friendlier error messages when packages.yml is malformed
time: 2022-09-12T12:59:35.121188+01:00
custom:
Author: jared-rimmer
Issue: "5486"
PR: "5812"

View File

@@ -1,7 +0,0 @@
kind: Features
body: Migrate dbt-utils current_timestamp macros into core + adapters
time: 2022-09-14T09:56:25.97818-07:00
custom:
Author: colin-rogers-dbt
Issue: "5521"
PR: "5838"

View File

@@ -1,7 +0,0 @@
kind: Features
body: Allow partitions in external tables to be supplied as a list
time: 2022-09-25T21:16:51.051239654+02:00
custom:
Author: pgoslatara
Issue: "5929"
PR: "5930"

View File

@@ -1,7 +0,0 @@
kind: Features
body: extend -f flag shorthand for seed command
time: 2022-10-03T11:07:05.381632-05:00
custom:
Author: dave-connors-3
Issue: "5990"
PR: "5991"

View File

@@ -1,8 +0,0 @@
kind: Features
body: This pulls the profile name from args when constructing a RuntimeConfig in lib.py,
enabling the dbt-server to override the value that's in the dbt_project.yml
time: 2022-11-02T15:00:03.000805-05:00
custom:
Author: racheldaniel
Issue: "6201"
PR: "6202"

View File

@@ -1,7 +0,0 @@
kind: Features
body: Added an md5 function to the base context
time: 2022-11-14T18:52:07.788593+02:00
custom:
Author: haritamar
Issue: "6246"
PR: "6247"

View File

@@ -1,7 +0,0 @@
kind: Features
body: Exposures support metrics in lineage
time: 2022-11-30T11:29:13.256034-05:00
custom:
Author: michelleark
Issue: "6057"
PR: "6342"

View File

@@ -1,7 +0,0 @@
kind: Fixes
body: Account for disabled flags on models in schema files more completely
time: 2022-09-16T10:48:54.162273-05:00
custom:
Author: emmyoop
Issue: "3992"
PR: "5868"

View File

@@ -1,7 +0,0 @@
kind: Fixes
body: Add validation of enabled config for metrics, exposures and sources
time: 2022-10-10T11:32:18.752322-05:00
custom:
Author: emmyoop
Issue: "6030"
PR: "6038"

View File

@@ -1,7 +0,0 @@
kind: Fixes
body: check length of args of python model function before accessing it
time: 2022-10-11T16:07:15.464093-04:00
custom:
Author: chamini2
Issue: "6041"
PR: "6042"

View File

@@ -1,8 +0,0 @@
kind: Fixes
body: Add functors to ensure event types with str-type attributes are initialized
to spec, even when provided non-str type params.
time: 2022-10-16T17:37:42.846683-07:00
custom:
Author: versusfacit
Issue: "5436"
PR: "5874"

View File

@@ -1,7 +0,0 @@
kind: Fixes
body: Allow hooks to fail without halting execution flow
time: 2022-11-07T09:53:14.340257-06:00
custom:
Author: ChenyuLInx
Issue: "5625"
PR: "6059"

View File

@@ -1,7 +0,0 @@
kind: Fixes
body: Clarify Error Message for how many models are allowed in a Python file
time: 2022-11-15T08:10:21.527884-05:00
custom:
Author: justbldwn
Issue: "6245"
PR: "6251"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Put black config in explicit config
time: 2022-09-27T19:42:59.241433-07:00
custom:
Author: max-sixty
Issue: "5946"
PR: "5947"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Added flat_graph attribute the Manifest class's deepcopy() coverage
time: 2022-09-29T13:44:06.275941-04:00
custom:
Author: peterallenwebb
Issue: "5809"
PR: "5975"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Add mypy configs so `mypy` passes from CLI
time: 2022-10-05T12:03:10.061263-07:00
custom:
Author: max-sixty
Issue: "5983"
PR: "5983"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Exception message cleanup.
time: 2022-10-07T09:46:27.682872-05:00
custom:
Author: emmyoop
Issue: "6023"
PR: "6024"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Add dmypy cache to gitignore
time: 2022-10-07T14:00:44.227644-07:00
custom:
Author: max-sixty
Issue: "6028"
PR: "5978"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Provide useful errors when the value of 'materialized' is invalid
time: 2022-10-13T18:19:12.167548-04:00
custom:
Author: peterallenwebb
Issue: "5229"
PR: "6025"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Fixed extra whitespace in strings introduced by black.
time: 2022-10-17T15:15:11.499246-05:00
custom:
Author: luke-bassett
Issue: "1350"
PR: "6086"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Clean up string formatting
time: 2022-10-17T15:58:44.676549-04:00
custom:
Author: eve-johns
Issue: "6068"
PR: "6082"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Remove the 'root_path' field from most nodes
time: 2022-10-28T10:48:37.687886-04:00
custom:
Author: gshank
Issue: "6171"
PR: "6172"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Combine certain logging events with different levels
time: 2022-10-28T11:03:44.887836-04:00
custom:
Author: gshank
Issue: "6173"
PR: "6174"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Convert threading tests to pytest
time: 2022-11-08T07:45:50.589147-06:00
custom:
Author: stu-k
Issue: "5942"
PR: "6226"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Convert postgres index tests to pytest
time: 2022-11-08T11:56:33.743042-06:00
custom:
Author: stu-k
Issue: "5770"
PR: "6228"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Convert use color tests to pytest
time: 2022-11-08T13:31:04.788547-06:00
custom:
Author: stu-k
Issue: "5771"
PR: "6230"

View File

@@ -1,7 +0,0 @@
kind: Under the Hood
body: Add github actions workflow to generate high level CLI API docs
time: 2022-11-16T13:00:37.916202-06:00
custom:
Author: stu-k
Issue: "5942"
PR: "6187"

47
.changie.yaml Normal file → Executable file
View File

@@ -7,26 +7,14 @@ 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: '- {{.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}}))' 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}}))'
kinds: kinds:
- label: Breaking Changes - label: Breaking Changes
- label: Features - label: Features
- label: Fixes - label: Fixes
- label: Docs - label: Docs
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}}))' - label: Under the Hood
- label: Under the Hood - label: Dependencies
- label: Dependencies - label: Security
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}}))'
- label: Security
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}}))'
newlines:
afterChangelogHeader: 1
afterKind: 1
afterChangelogVersion: 1
beforeKind: 1
endOfVersion: 1
custom: custom:
- key: Author - key: Author
label: GitHub Username(s) (separated by a single space if multiple) label: GitHub Username(s) (separated by a single space if multiple)
@@ -35,16 +23,15 @@ custom:
- key: Issue - key: Issue
label: GitHub Issue Number label: GitHub Issue Number
type: int type: int
minInt: 1 minLength: 4
- key: PR - key: PR
label: GitHub Pull Request Number label: GitHub Pull Request Number
type: int type: int
minInt: 1 minLength: 4
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" "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 PR */}} {{- /* loop through all authors for a PR */}}
@@ -52,20 +39,14 @@ footerFormat: |
{{- $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)}}
{{- /* Docs kind link back to dbt-docs instead of dbt-core PRs */}} {{- $pr := $change.Custom.PR }}
{{- $prLink := $change.Kind }}
{{- if eq $change.Kind "Docs" }}
{{- $prLink = "[dbt-docs/#pr](https://github.com/dbt-labs/dbt-docs/pull/pr)" | replace "pr" $change.Custom.PR }}
{{- else }}
{{- $prLink = "[#pr](https://github.com/dbt-labs/dbt-core/pull/pr)" | replace "pr" $change.Custom.PR }}
{{- end }}
{{- /* check if this contributor has other PRs associated with them already */}} {{- /* check if this contributor has other PRs associated with them already */}}
{{- if hasKey $contributorDict $author }} {{- if hasKey $contributorDict $author }}
{{- $prList := get $contributorDict $author }} {{- $prList := get $contributorDict $author }}
{{- $prList = append $prList $prLink }} {{- $prList = append $prList $pr }}
{{- $contributorDict := set $contributorDict $author $prList }} {{- $contributorDict := set $contributorDict $author $prList }}
{{- else }} {{- else }}
{{- $prList := list $prLink }} {{- $prList := list $change.Custom.PR }}
{{- $contributorDict := set $contributorDict $author $prList }} {{- $contributorDict := set $contributorDict $author $prList }}
{{- end }} {{- end }}
{{- end}} {{- end}}
@@ -75,6 +56,6 @@ footerFormat: |
{{- if $contributorDict}} {{- if $contributorDict}}
### Contributors ### Contributors
{{- range $k,$v := $contributorDict }} {{- range $k,$v := $contributorDict }}
- [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}}) - [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}[#{{$element}}](https://github.com/dbt-labs/dbt-core/pull/{{$element}}){{end}})
{{- end }} {{- end }}
{{- end }} {{- end }}

42
.github/CODEOWNERS vendored
View File

@@ -16,57 +16,25 @@
# Changes to GitHub configurations including Actions # Changes to GitHub configurations including Actions
/.github/ @leahwicz /.github/ @leahwicz
### LANGUAGE
# Language core modules # Language core modules
/core/dbt/config/ @dbt-labs/core-language /core/dbt/config/ @dbt-labs/core-language
/core/dbt/context/ @dbt-labs/core-language /core/dbt/context/ @dbt-labs/core-language
/core/dbt/contracts/ @dbt-labs/core-language /core/dbt/contracts/ @dbt-labs/core-language
/core/dbt/deps/ @dbt-labs/core-language /core/dbt/deps/ @dbt-labs/core-language
/core/dbt/events/ @dbt-labs/core-language # structured logging
/core/dbt/parser/ @dbt-labs/core-language /core/dbt/parser/ @dbt-labs/core-language
# Language misc files
/core/dbt/dataclass_schema.py @dbt-labs/core-language
/core/dbt/hooks.py @dbt-labs/core-language
/core/dbt/node_types.py @dbt-labs/core-language
/core/dbt/semver.py @dbt-labs/core-language
### EXECUTION
# Execution core modules # Execution core modules
/core/dbt/events/ @dbt-labs/core-execution @dbt-labs/core-language # eventually remove language but they have knowledge here now
/core/dbt/graph/ @dbt-labs/core-execution /core/dbt/graph/ @dbt-labs/core-execution
/core/dbt/task/ @dbt-labs/core-execution /core/dbt/task/ @dbt-labs/core-execution
# Execution misc files # Adapter interface, scaffold, Postgres plugin
/core/dbt/compilation.py @dbt-labs/core-execution
/core/dbt/flags.py @dbt-labs/core-execution
/core/dbt/lib.py @dbt-labs/core-execution
/core/dbt/main.py @dbt-labs/core-execution
/core/dbt/profiler.py @dbt-labs/core-execution
/core/dbt/selected_resources.py @dbt-labs/core-execution
/core/dbt/tracking.py @dbt-labs/core-execution
/core/dbt/version.py @dbt-labs/core-execution
### ADAPTERS
# Adapter interface ("base" + "sql" adapter defaults, cache)
/core/dbt/adapters @dbt-labs/core-adapters /core/dbt/adapters @dbt-labs/core-adapters
/core/scripts/create_adapter_plugin.py @dbt-labs/core-adapters
# Global project (default macros + materializations), starter project
/core/dbt/include @dbt-labs/core-adapters
# Postgres plugin
/plugins/ @dbt-labs/core-adapters /plugins/ @dbt-labs/core-adapters
# Functional tests for adapter plugins # Global project: default macros, including generic tests + materializations
/tests/adapter @dbt-labs/core-adapters /core/dbt/include/global_project @dbt-labs/core-execution @dbt-labs/core-adapters
### TESTS
# Overlapping ownership for vast majority of unit + functional tests
# Perf regression testing framework # Perf regression testing framework
# This excludes the test project files itself since those aren't specific # This excludes the test project files itself since those aren't specific

View File

@@ -20,4 +20,4 @@ resolves #
- [ ] I have run this code in development and it appears to resolve the stated issue - [ ] I have run this code in development and it appears to resolve the stated issue
- [ ] This PR includes tests, or tests are not required/relevant for this PR - [ ] This PR includes tests, or tests are not required/relevant for this PR
- [ ] I have [opened an issue to add/update docs](https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose), or docs changes are not required/relevant for this PR - [ ] I have [opened an issue to add/update docs](https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose), or docs changes are not required/relevant for this PR
- [ ] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-a-changelog-entry) - [ ] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#Adding-CHANGELOG-Entry)

View File

@@ -28,7 +28,7 @@ name: Bot Changelog
on: on:
pull_request: pull_request:
# catch when the PR is opened with the label or when the label is added # catch when the PR is opened with the label or when the label is added
types: [labeled] types: [opened, labeled]
permissions: permissions:
contents: write contents: write
@@ -48,9 +48,9 @@ jobs:
steps: steps:
- name: Create and commit changelog on bot PR - name: Create and commit changelog on bot PR
if: ${{ contains(github.event.pull_request.labels.*.name, matrix.label) }} if: "contains(github.event.pull_request.labels.*.name, ${{ matrix.label }})"
id: bot_changelog id: bot_changelog
uses: emmyoop/changie_bot@v1.0.1 uses: emmyoop/changie_bot@v1.0
with: with:
GITHUB_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }} GITHUB_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }}
commit_author_name: "Github Build Bot" commit_author_name: "Github Build Bot"
@@ -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 Issue: 4904\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 }}\n"

View File

@@ -33,7 +33,7 @@ permissions:
jobs: jobs:
changelog: changelog:
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@er/changelog-check
with: with:
changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. 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).' changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. 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).'
skip_label: 'Skip Changelog' skip_label: 'Skip Changelog'

View File

@@ -1,166 +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
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 }}"
echo ">>>>> git log"
git log --pretty=oneline | head -5
- 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 }}

View File

@@ -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

View File

@@ -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: |
@@ -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 }}
@@ -119,7 +117,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"] 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
@@ -139,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 }}
@@ -192,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: |

View File

@@ -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, main]
steps: steps:
- name: Call CI workflow for ${{ matrix.branch }} branch - name: Call CI workflow for ${{ matrix.branch }} branch

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
@@ -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:

8
.gitignore vendored
View File

@@ -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,3 @@ venv/
# vscode # vscode
.vscode/ .vscode/
*.code-workspace
# poetry
poetry.lock

View File

@@ -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

View File

@@ -4,14 +4,49 @@
- Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases. - Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases.
- "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-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.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)

View File

@@ -7,9 +7,7 @@
3. [Setting up an environment](#setting-up-an-environment) 3. [Setting up an environment](#setting-up-an-environment)
4. [Running `dbt` in development](#running-dbt-core-in-development) 4. [Running `dbt` in development](#running-dbt-core-in-development)
5. [Testing dbt-core](#testing) 5. [Testing dbt-core](#testing)
6. [Debugging](#debugging) 6. [Submitting a Pull Request](#submitting-a-pull-request)
7. [Adding a changelog entry](#adding-a-changelog-entry)
8. [Submitting a Pull Request](#submitting-a-pull-request)
## About this document ## About this document
@@ -23,8 +21,7 @@ If you get stuck, we're happy to help! Drop us a line in the `#dbt-core-developm
- **Adapters:** Is your issue or proposed code change related to a specific [database adapter](https://docs.getdbt.com/docs/available-adapters)? If so, please open issues, PRs, and discussions in that adapter's repository instead. The sole exception is Postgres; the `dbt-postgres` plugin lives in this repository (`dbt-core`). - **Adapters:** Is your issue or proposed code change related to a specific [database adapter](https://docs.getdbt.com/docs/available-adapters)? If so, please open issues, PRs, and discussions in that adapter's repository instead. The sole exception is Postgres; the `dbt-postgres` plugin lives in this repository (`dbt-core`).
- **CLA:** Please note that anyone contributing code to `dbt-core` must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements). If you are unable to sign the CLA, the `dbt-core` maintainers will unfortunately be unable to merge any of your Pull Requests. We welcome you to participate in discussions, open issues, and comment on existing ones. - **CLA:** Please note that anyone contributing code to `dbt-core` must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements). If you are unable to sign the CLA, the `dbt-core` maintainers will unfortunately be unable to merge any of your Pull Requests. We welcome you to participate in discussions, open issues, and comment on existing ones.
- **Branches:** All pull requests from community contributors should target the `main` branch (default). If the change is needed as a patch for a minor version of dbt that has already been released (or is already a release candidate), a maintainer will backport the changes in your PR to the relevant "latest" release branch (`1.0.latest`, `1.1.latest`, ...). If an issue fix applies to a release branch, that fix should be first committed to the development branch and then to the release branch (rarely release-branch fixes may not apply to `main`). - **Branches:** All pull requests from community contributors should target the `main` branch (default). If the change is needed as a patch for a minor version of dbt that has already been released (or is already a release candidate), a maintainer will backport the changes in your PR to the relevant "latest" release branch (`1.0.latest`, `1.1.latest`, ...)
- **Releases**: Before releasing a new minor version of Core, we prepare a series of alphas and release candidates to allow users (especially employees of dbt Labs!) to test the new version in live environments. This is an important quality assurance step, as it exposes the new code to a wide variety of complicated deployments and can surface bugs before official release. Releases are accessible via pip, homebrew, and dbt Cloud.
## Getting the code ## Getting the code
@@ -44,9 +41,7 @@ If you are not a member of the `dbt-labs` GitHub organization, you can contribut
### dbt Labs contributors ### dbt Labs contributors
If you are a member of the `dbt-labs` GitHub organization, you will have push access to the `dbt-core` repo. Rather than forking `dbt-core` to make your changes, just clone the repository, check out a new branch, and push directly to that branch. Branch names should be fixed by `CT-XXX/` where: If you are a member of the `dbt-labs` GitHub organization, you will have push access to the `dbt-core` repo. Rather than forking `dbt-core` to make your changes, just clone the repository, check out a new branch, and push directly to that branch.
* CT stands for 'core team'
* XXX stands for a JIRA ticket number
## Setting up an environment ## Setting up an environment
@@ -156,7 +151,7 @@ Check out the other targets in the Makefile to see other commonly used test
suites. suites.
#### `pre-commit` #### `pre-commit`
[`pre-commit`](https://pre-commit.com) takes care of running all code-checks for formatting and linting. Run `make dev` to install `pre-commit` in your local environment (we recommend running this command with a python virtual environment active). This command installs several pip executables including black, mypy, and flake8. Once this is done you can use any of the linter-based make targets as well as a git pre-commit hook that will ensure proper formatting and linting. [`pre-commit`](https://pre-commit.com) takes care of running all code-checks for formatting and linting. Run `make dev` to install `pre-commit` in your local environment. Once this is done you can use any of the linter-based make targets as well as a git pre-commit hook that will ensure proper formatting and linting.
#### `tox` #### `tox`
@@ -179,29 +174,7 @@ python3 -m pytest tests/functional/sources
> See [pytest usage docs](https://docs.pytest.org/en/6.2.x/usage.html) for an overview of useful command-line options. > See [pytest usage docs](https://docs.pytest.org/en/6.2.x/usage.html) for an overview of useful command-line options.
### Unit, Integration, Functional? ## Adding CHANGELOG Entry
Here are some general rules for adding tests:
* unit tests (`test/unit` & `tests/unit`) dont need to access a database; "pure Python" tests should be written as unit tests
* functional tests (`test/integration` & `tests/functional`) cover anything that interacts with a database, namely adapter
* *everything in* `test/*` *is being steadily migrated to* `tests/*`
## Debugging
1. The logs for a `dbt run` have stack traces and other information for debugging errors (in `logs/dbt.log` in your project directory).
2. Try using a debugger, like `ipdb`. For pytest: `--pdb --pdbcls=IPython.terminal.debugger:pdb`
3. Sometimes, its easier to debug on a single thread: `dbt --single-threaded run`
4. To make print statements from Jinja macros: `{{ log(msg, info=true) }}`
5. You can also add `{{ debug() }}` statements, which will drop you into some auto-generated code that the macro wrote.
6. The dbt “artifacts” are written out to the target directory of your dbt project. They are in unformatted json, which can be hard to read. Format them with:
> python -m json.tool target/run_results.json > run_results.json
### Assorted development tips
* Append `# type: ignore` to the end of a line if you need to disable `mypy` on that line.
* 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.
## 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.
@@ -213,10 +186,10 @@ You don't need to worry about which `dbt-core` version your change will go into.
## Submitting a Pull Request ## Submitting a Pull Request
Code can be merged into the current development branch `main` by opening a pull request. A `dbt-core` maintainer will review your PR. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code. A `dbt-core` maintainer will review your PR. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code.
Automated tests run via GitHub Actions. If you're a first-time contributor, all tests (including code checks and unit tests) will require a maintainer to approve. Changes in the `dbt-core` repository trigger integration tests against Postgres. dbt Labs also provides CI environments in which to test changes to other adapters, triggered by PRs in those adapters' repositories, as well as periodic maintenance checks of each adapter in concert with the latest `dbt-core` code changes. Automated tests run via GitHub Actions. If you're a first-time contributor, all tests (including code checks and unit tests) will require a maintainer to approve. Changes in the `dbt-core` repository trigger integration tests against Postgres. dbt Labs also provides CI environments in which to test changes to other adapters, triggered by PRs in those adapters' repositories, as well as periodic maintenance checks of each adapter in concert with the latest `dbt-core` code changes.
Once all tests are passing and your PR has been approved, a `dbt-core` maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada: Once all tests are passing and your PR has been approved, a `dbt-core` maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada:
Sometimes, the content license agreement auto-check bot doesn't find a user's entry in its roster. If you need to force a rerun, add `@cla-bot check` in a comment on the pull request. change that doesn't matter

View File

@@ -6,19 +6,6 @@ ifeq ($(USE_DOCKER),true)
DOCKER_CMD := docker-compose run --rm test DOCKER_CMD := docker-compose run --rm test
endif endif
LOGS_DIR := ./logs
# Optional flag to invoke tests using our CI env.
# But we always want these active for structured
# log testing.
CI_FLAGS =\
DBT_TEST_USER_1=dbt_test_user_1\
DBT_TEST_USER_2=dbt_test_user_2\
DBT_TEST_USER_3=dbt_test_user_3\
RUSTFLAGS="-D warnings"\
LOG_DIR=./logs\
DBT_LOG_FORMAT=json
.PHONY: dev .PHONY: dev
dev: ## Installs dbt-* packages in develop mode along with development dependencies. dev: ## Installs dbt-* packages in develop mode along with development dependencies.
@\ @\
@@ -61,20 +48,13 @@ test: .env ## Runs unit tests with py and code checks against staged changes.
.PHONY: integration .PHONY: integration
integration: .env ## Runs postgres integration tests with py-integration integration: .env ## Runs postgres integration tests with py-integration
@\ @\
$(if $(USE_CI_FLAGS), $(CI_FLAGS)) $(DOCKER_CMD) tox -e py-integration -- -nauto $(DOCKER_CMD) tox -e py-integration -- -nauto
.PHONY: integration-fail-fast .PHONY: integration-fail-fast
integration-fail-fast: .env ## Runs postgres integration tests with py-integration in "fail fast" mode. integration-fail-fast: .env ## Runs postgres integration tests with py-integration in "fail fast" mode.
@\ @\
$(DOCKER_CMD) tox -e py-integration -- -x -nauto $(DOCKER_CMD) tox -e py-integration -- -x -nauto
.PHONY: interop
interop: clean
@\
mkdir $(LOGS_DIR) && \
$(CI_FLAGS) $(DOCKER_CMD) tox -e py-integration -- -nauto && \
LOG_DIR=$(LOGS_DIR) cargo run --manifest-path test/interop/log_parsing/Cargo.toml
.PHONY: setup-db .PHONY: setup-db
setup-db: ## Setup Postgres database with docker-compose for system testing. setup-db: ## Setup Postgres database with docker-compose for system testing.
@\ @\
@@ -96,7 +76,6 @@ endif
clean: ## Resets development environment. clean: ## Resets development environment.
@echo 'cleaning repo...' @echo 'cleaning repo...'
@rm -f .coverage @rm -f .coverage
@rm -f .coverage.*
@rm -rf .eggs/ @rm -rf .eggs/
@rm -f .env @rm -f .env
@rm -rf .tox/ @rm -rf .tox/

View File

@@ -1,2 +1 @@
recursive-include dbt/include *.py *.sql *.yml *.html *.md .gitkeep .gitignore recursive-include dbt/include *.py *.sql *.yml *.html *.md .gitkeep .gitignore
include dbt/py.typed

View File

@@ -1,10 +0,0 @@
## Base adapters
### impl.py
The class `SQLAdapter` in [base/imply.py](https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/adapters/base/impl.py) is a (mostly) abstract object that adapter objects inherit from. The base class scaffolds out methods that every adapter project usually should implement for smooth communication between dbt and database.
Some target databases require more or fewer methods--it all depends on what the warehouse's featureset is.
Look into the class for function-level comments.

View File

@@ -10,5 +10,5 @@ from dbt.adapters.base.relation import ( # noqa
SchemaSearchMap, SchemaSearchMap,
) )
from dbt.adapters.base.column import Column # noqa from dbt.adapters.base.column import Column # noqa
from dbt.adapters.base.impl import AdapterConfig, BaseAdapter, PythonJobHelper # noqa from dbt.adapters.base.impl import AdapterConfig, BaseAdapter # noqa
from dbt.adapters.base.plugin import AdapterPlugin # noqa from dbt.adapters.base.plugin import AdapterPlugin # noqa

View File

@@ -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

View File

@@ -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,15 +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 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.
@@ -306,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
@@ -334,21 +332,17 @@ 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()
)
)
@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(ConnectionClosed(conn_name=cast_to_str(connection.name))) fire_event(ConnectionClosed2(conn_name=connection.name))
connection.handle.close() connection.handle.close()
else: else:
fire_event(ConnectionLeftOpen(conn_name=cast_to_str(connection.name))) fire_event(ConnectionLeftOpen2(conn_name=connection.name))
@classmethod @classmethod
def _rollback(cls, connection: Connection) -> None: def _rollback(cls, connection: Connection) -> None:
@@ -359,7 +353,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
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))) fire_event(Rollback(conn_name=connection.name))
cls._rollback_handle(connection) cls._rollback_handle(connection)
connection.transaction_open = False connection.transaction_open = False
@@ -371,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))) fire_event(Rollback(conn_name=connection.name))
cls._rollback_handle(connection) cls._rollback_handle(connection)
connection.transaction_open = False connection.transaction_open = False

View File

@@ -41,15 +41,15 @@ from dbt.clients.jinja import MacroGenerator
from dbt.contracts.graph.compiled import CompileResultNode, CompiledSeedNode 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.parsed import ParsedSeedNode 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
@@ -60,8 +60,7 @@ from dbt.adapters.base.relation import (
SchemaSearchMap, SchemaSearchMap,
) )
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.cache import RelationsCache, _make_key
from dbt.adapters.cache import RelationsCache, _make_ref_key_msg
SeedModel = Union[ParsedSeedNode, CompiledSeedNode] SeedModel = Union[ParsedSeedNode, CompiledSeedNode]
@@ -128,35 +127,6 @@ def _relation_name(rel: Optional[BaseRelation]) -> str:
return str(rel) return str(rel)
def log_code_execution(code_execution_function):
# decorator to log code and execution time
if code_execution_function.__name__ != "submit_python_job":
raise ValueError("this should be only used to log submit_python_job now")
def execution_with_log(*args):
self = args[0]
connection_name = self.connections.get_thread_connection().name
fire_event(CodeExecution(conn_name=connection_name, code_content=args[2]))
start_time = time.time()
response = code_execution_function(*args)
fire_event(
CodeExecutionStatus(
status=response._message, elapsed=round((time.time() - start_time), 2)
)
)
return response
return execution_with_log
class PythonJobHelper:
def __init__(self, parsed_model: Dict, credential: Credentials) -> None:
raise NotImplementedError("PythonJobHelper is not implemented yet")
def submit(self, compiled_code: str) -> Any:
raise NotImplementedError("PythonJobHelper submit function is not implemented yet")
class BaseAdapter(metaclass=AdapterMeta): class BaseAdapter(metaclass=AdapterMeta):
"""The BaseAdapter provides an abstract base class for adapters. """The BaseAdapter provides an abstract base class for adapters.
@@ -343,7 +313,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,
) )
) )
@@ -581,7 +551,7 @@ class BaseAdapter(metaclass=AdapterMeta):
:rtype: List[self.Relation] :rtype: List[self.Relation]
""" """
raise NotImplementedException( raise NotImplementedException(
"`list_relations_without_caching` is not implemented for this adapter!" "`list_relations_without_caching` is not implemented for this " "adapter!"
) )
### ###
@@ -726,9 +696,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],
) )
) )
@@ -1212,36 +1182,9 @@ class BaseAdapter(metaclass=AdapterMeta):
return sql return sql
@property @available.parse_none
def python_submission_helpers(self) -> Dict[str, Type[PythonJobHelper]]: def submit_python_job(self, parsed_model: dict, compiled_code: str):
raise NotImplementedError("python_submission_helpers is not specified") raise NotImplementedException("`submit_python_job` is not implemented for this adapter!")
@property
def default_python_submission_method(self) -> str:
raise NotImplementedError("default_python_submission_method is not specified")
@log_code_execution
def submit_python_job(self, parsed_model: dict, compiled_code: str) -> AdapterResponse:
submission_method = parsed_model["config"].get(
"submission_method", self.default_python_submission_method
)
if submission_method not in self.python_submission_helpers:
raise NotImplementedError(
"Submission method {} is not supported for current adapter".format(
submission_method
)
)
job_helper = self.python_submission_helpers[submission_method](
parsed_model, self.connections.profile.credentials
)
submission_result = job_helper.submit(compiled_code)
# process submission result to generate adapter response
return self.generate_python_submission_response(submission_result)
def generate_python_submission_response(self, submission_result: Any) -> AdapterResponse:
raise NotImplementedException(
"Your adapter need to implement generate_python_submission_response"
)
def valid_incremental_strategies(self): def valid_incremental_strategies(self):
"""The set of standard builtin strategies which this adapter supports out-of-the-box. """The set of standard builtin strategies which this adapter supports out-of-the-box.
@@ -1327,7 +1270,28 @@ 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
def log_code_execution(code_execution_function):
# decorator to log code and execution time
if code_execution_function.__name__ != "submit_python_job":
raise ValueError("this should be only used to log submit_python_job now")
def execution_with_log(*args):
self = args[0]
connection_name = self.connections.get_thread_connection().name
fire_event(CodeExecution(conn_name=connection_name, code_content=args[2]))
start_time = time.time()
response = code_execution_function(*args)
fire_event(
CodeExecutionStatus(
status=response._message, elapsed=round((time.time() - start_time), 2)
)
)
return response
return execution_with_log

View File

@@ -1,16 +1,10 @@
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,
_make_ref_key_msg,
_make_msg_from_ref_key,
_ReferenceKey,
)
import dbt.exceptions import dbt.exceptions
from dbt.events.functions import fire_event, fire_event_if from dbt.events.functions import fire_event
from dbt.events.types import ( from dbt.events.types import (
AddLink, AddLink,
AddRelation, AddRelation,
@@ -26,8 +20,8 @@ from dbt.events.types import (
UncachedRelation, UncachedRelation,
UpdateReference, UpdateReference,
) )
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:
@@ -87,7 +81,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
@@ -299,18 +293,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))
UncachedRelation(
dep_key=_make_msg_from_ref_key(dep_key),
ref_key=_make_msg_from_ref_key(ref_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.
@@ -320,11 +309,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))
AddLink(
dep_key=_make_msg_from_ref_key(dep_key), ref_key=_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)
@@ -335,12 +320,12 @@ class RelationsCache:
:param BaseRelation relation: The underlying relation. :param BaseRelation relation: The underlying relation.
""" """
cached = _CachedRelation(relation) cached = _CachedRelation(relation)
fire_event(AddRelation(relation=_make_ref_key_msg(cached))) fire_event(AddRelation(relation=_make_key(cached)))
fire_event_if(flags.LOG_CACHE_EVENTS, lambda: DumpBeforeAddGraph(dump=self.dump_graph())) fire_event(DumpBeforeAddGraph(dump=Lazy.defer(lambda: self.dump_graph())))
with self.lock: with self.lock:
self._setdefault(cached) self._setdefault(cached)
fire_event_if(flags.LOG_CACHE_EVENTS, lambda: DumpAfterAddGraph(dump=self.dump_graph())) fire_event(DumpAfterAddGraph(dump=Lazy.defer(lambda: 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
@@ -355,6 +340,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.
@@ -366,19 +364,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(DropRelation(dropped=dropped_key_msg))
with self.lock: with self.lock:
if dropped_key not in self.relations: self._drop_cascade_relation(dropped_key)
fire_event(DropMissingRelation(relation=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(DropCascade(dropped=dropped_key_msg, consequences=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.
@@ -394,17 +383,13 @@ 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(
UpdateReference( UpdateReference(old_key=old_key, new_key=new_key, cached_key=cached.key())
old_key=_make_ref_key_msg(old_key),
new_key=_make_ref_key_msg(new_key),
cached_key=_make_ref_key_msg(cached.key()),
)
) )
cached.rename_key(old_key, new_key) cached.rename_key(old_key, new_key)
@@ -428,29 +413,14 @@ class RelationsCache:
:raises InternalError: If the new key is already present. :raises InternalError: If the new key is already present.
""" """
if new_key in self.relations: if new_key in self.relations:
# Tell user when collision caused by model names truncated during
# materialization.
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( dbt.exceptions.raise_cache_inconsistent(
"in rename, new key {} already in cache: {}{}".format( "in rename, new key {} already in cache: {}".format(
new_key, list(self.relations.keys()), message_addendum new_key, list(self.relations.keys())
) )
) )
if old_key not in self.relations: if old_key not in self.relations:
fire_event(TemporaryRelation(key=_make_msg_from_ref_key(old_key))) fire_event(TemporaryRelation(key=old_key))
return False return False
return True return True
@@ -466,17 +436,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))
RenameSchema(
old_key=_make_msg_from_ref_key(old_key), new_key=_make_msg_from_ref_key(new)
)
)
fire_event_if( fire_event(DumpBeforeRenameSchema(dump=Lazy.defer(lambda: self.dump_graph())))
flags.LOG_CACHE_EVENTS, lambda: DumpBeforeRenameSchema(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):
@@ -484,9 +448,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: DumpAfterRenameSchema(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.
@@ -534,6 +496,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)

View File

@@ -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 InternalException, RuntimeException 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
@@ -59,12 +64,12 @@ 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 RuntimeException(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()
@@ -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()

View File

@@ -88,7 +88,7 @@ class AdapterProtocol( # type: ignore[misc]
], ],
): ):
# N.B. Technically these are ClassVars, but mypy doesn't support putting type vars in a # N.B. Technically these are ClassVars, but mypy doesn't support putting type vars in a
# ClassVar due to the restrictiveness of PEP-526 # ClassVar due to the restirctiveness of PEP-526
# See: https://github.com/python/mypy/issues/5144 # See: https://github.com/python/mypy/issues/5144
AdapterSpecificConfigs: Type[AdapterConfig_T] AdapterSpecificConfigs: Type[AdapterConfig_T]
Column: Type[Column_T] Column: Type[Column_T]

View File

@@ -2,7 +2,6 @@
from collections import namedtuple from collections import namedtuple
from typing import Any, Optional from typing import Any, Optional
from dbt.events.proto_types import ReferenceKeyMsg
_ReferenceKey = namedtuple("_ReferenceKey", "database schema identifier") _ReferenceKey = namedtuple("_ReferenceKey", "database schema identifier")
@@ -15,12 +14,7 @@ def lowercase(value: Optional[str]) -> Optional[str]:
return value.lower() return value.lower()
# For backwards compatibility. New code should use _make_ref_key
def _make_key(relation: Any) -> _ReferenceKey: def _make_key(relation: Any) -> _ReferenceKey:
return _make_ref_key(relation)
def _make_ref_key(relation: Any) -> _ReferenceKey:
"""Make _ReferenceKeys with lowercase values for the cache so we don't have """Make _ReferenceKeys with lowercase values for the cache so we don't have
to keep track of quoting to keep track of quoting
""" """
@@ -28,13 +22,3 @@ def _make_ref_key(relation: Any) -> _ReferenceKey:
return _ReferenceKey( return _ReferenceKey(
lowercase(relation.database), lowercase(relation.schema), lowercase(relation.identifier) lowercase(relation.database), lowercase(relation.schema), lowercase(relation.identifier)
) )
def _make_ref_key_msg(relation: Any):
return _make_msg_from_ref_key(_make_ref_key(relation))
def _make_msg_from_ref_key(ref_key: _ReferenceKey) -> ReferenceKeyMsg:
return ReferenceKeyMsg(
database=ref_key.database, schema=ref_key.schema, identifier=ref_key.identifier
)

View File

@@ -10,7 +10,6 @@ from dbt.adapters.base import BaseConnectionManager
from dbt.contracts.connection import Connection, ConnectionState, AdapterResponse from dbt.contracts.connection import Connection, ConnectionState, AdapterResponse
from dbt.events.functions import fire_event from dbt.events.functions import fire_event
from dbt.events.types import ConnectionUsed, SQLQuery, SQLCommit, SQLQueryStatus from dbt.events.types import ConnectionUsed, SQLQuery, SQLCommit, SQLQueryStatus
from dbt.utils import cast_to_str
class SQLConnectionManager(BaseConnectionManager): class SQLConnectionManager(BaseConnectionManager):
@@ -56,7 +55,7 @@ class SQLConnectionManager(BaseConnectionManager):
connection = self.get_thread_connection() connection = self.get_thread_connection()
if auto_begin and connection.transaction_open is False: if auto_begin and connection.transaction_open is False:
self.begin() self.begin()
fire_event(ConnectionUsed(conn_type=self.TYPE, conn_name=cast_to_str(connection.name))) fire_event(ConnectionUsed(conn_type=self.TYPE, conn_name=connection.name))
with self.exception_handler(sql): with self.exception_handler(sql):
if abridge_sql_log: if abridge_sql_log:
@@ -64,7 +63,7 @@ class SQLConnectionManager(BaseConnectionManager):
else: else:
log_sql = sql log_sql = sql
fire_event(SQLQuery(conn_name=cast_to_str(connection.name), sql=log_sql)) fire_event(SQLQuery(conn_name=connection.name, sql=log_sql))
pre = time.time() pre = time.time()
cursor = connection.handle.cursor() cursor = connection.handle.cursor()

View File

@@ -5,7 +5,7 @@ import dbt.clients.agate_helper
from dbt.contracts.connection import Connection from dbt.contracts.connection import Connection
import dbt.exceptions import dbt.exceptions
from dbt.adapters.base import BaseAdapter, available from dbt.adapters.base import BaseAdapter, available
from dbt.adapters.cache import _make_ref_key_msg from dbt.adapters.cache import _make_key
from dbt.adapters.sql import SQLConnectionManager from dbt.adapters.sql import SQLConnectionManager
from dbt.events.functions import fire_event from dbt.events.functions import fire_event
from dbt.events.types import ColTypeChange, SchemaCreation, SchemaDrop from dbt.events.types import ColTypeChange, SchemaCreation, SchemaDrop
@@ -110,7 +110,7 @@ class SQLAdapter(BaseAdapter):
ColTypeChange( ColTypeChange(
orig_type=target_column.data_type, orig_type=target_column.data_type,
new_type=new_type, new_type=new_type,
table=_make_ref_key_msg(current), table=_make_key(current),
) )
) )
@@ -155,7 +155,7 @@ class SQLAdapter(BaseAdapter):
def create_schema(self, relation: BaseRelation) -> None: def create_schema(self, relation: BaseRelation) -> None:
relation = relation.without_identifier() relation = relation.without_identifier()
fire_event(SchemaCreation(relation=_make_ref_key_msg(relation))) fire_event(SchemaCreation(relation=_make_key(relation)))
kwargs = { kwargs = {
"relation": relation, "relation": relation,
} }
@@ -166,7 +166,7 @@ class SQLAdapter(BaseAdapter):
def drop_schema(self, relation: BaseRelation) -> None: def drop_schema(self, relation: BaseRelation) -> None:
relation = relation.without_identifier() relation = relation.without_identifier()
fire_event(SchemaDrop(relation=_make_ref_key_msg(relation))) fire_event(SchemaDrop(relation=_make_key(relation)))
kwargs = { kwargs = {
"relation": relation, "relation": relation,
} }

View File

@@ -1 +0,0 @@
TODO

Some files were not shown because too many files have changed in this diff Show More