Compare commits

...

828 Commits

Author SHA1 Message Date
VersusFacit
1c46fe2850 Pare down scope 2025-05-12 20:24:00 -07:00
VersusFacit
3e937c8c3d Remove unexplained code for now 2025-05-12 19:49:11 -07:00
VersusFacit
de9e7122d2 Successful TDD for injecting the sql header 2025-05-12 18:10:01 -07:00
VersusFacit
0f42592f25 We're intending to do both tests in this PR 2025-05-12 18:09:37 -07:00
Christophe Oudar
7241b679db Provide required missing context to resolve sql_header in unit tests 2025-05-12 17:54:33 -07:00
VersusFacit
948316597b Let's do the test first and TDD this issue. 2025-05-12 17:53:26 -07:00
Emily Rockman
f64a4883eb replace all runner names (#11595) 2025-05-12 15:15:41 -05:00
Emily Rockman
2883933549 fix command test (#11605)
* fix command test

* remove parameter
2025-05-12 14:55:52 -05:00
Kshitij Aranke
fe9c78eed8 Fix #11428: Add tags and meta config to exposures (#11589)
* Fix #11428: Add tags and meta config to exposures

* Add tags and meta to unit test

* Fix manifest integration test

* change meta order
2025-05-09 19:17:26 +01:00
Emily Rockman
a5ec58dab9 fix query comment tests (#11596) 2025-05-08 16:34:29 -05:00
Emily Rockman
29a79557d5 stop code checkout (#11575) 2025-05-06 13:23:12 -05:00
Emily Rockman
35fc3fdda2 add read only permissions (#11573) 2025-05-06 11:48:19 -05:00
Kshitij Aranke
8931262fa2 Make codecov informational-only (#11574) 2025-05-06 16:13:17 +01:00
Quigley Malcolm
85d31db1d4 Fix jsonschema validation that fires CustomKeyInConfigDeprecation (#11580)
* Fix detection of additional config property deprecation

Previously we were taking the first `key` on the `instance` property
of the jsonschema ValidationError. However, this validation error
is raised as an "anyOf" violation, which then has sub-errors in its
`context` property. To identify the key in violation, we have to
find the `additionalProperties` validation in the sub-errors. The key
that is an issue can then be parsed from that sub-error.

* Refactor key parsing from jsonschema ValidationError messages to single definition

* Update handling `additionalProperties` violations to handle multiple keys in violation

* Add changelog

* Remove guard logic in jsonschemas validation rule that is no longer needed
2025-05-05 09:33:21 -05:00
Quigley Malcolm
d48476a08d Gate jsonschema validations behind private environment variable (#11579) 2025-05-02 10:03:43 -05:00
Emily Rockman
02f695b423 stop directly using the output (#11555)
* stop directly using the output

* fix error
2025-04-30 13:25:52 -05:00
Gerda Shank
3c95db9c00 Move dbt.include.jsonschemas imports to avoid cycles (#11568) 2025-04-30 12:32:50 -04:00
Doug Beatty
fec20ff914 Install pre-commit in Docker container for running tests (#11545)
* fix Dockerfile.test

* add change

* Ensure that all instances where `pre-commit` is called are prefixed with `$(DOCKER_CMD)`

* Changelog entry

---------

Co-authored-by: Taichi Kato <taichi-8128@outlook.jp>
2025-04-30 16:26:40 +01:00
Kshitij Aranke
de38bc9b0d Fix seed path if project directory name changes (#11525)
* Fix seed path if project directory name changes

* Changelog entry

---------

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2025-04-29 17:56:49 +01:00
Quigley Malcolm
f4114130c9 Fix functional deprecation tests so they don't break on windows (#11547)
In a lot of our function deprecation warning tests we check for a
matching string within an event message. Some of these matches check
for a file path. The problem with this was that windows formats
file paths differently. This was causing the functional tests to
_fail_ when run in a windows environment. To fix this we've removed
the file path part of the string from the test assertions.
2025-04-28 10:21:56 -05:00
Quigley Malcolm
e920053306 Initial slate of deprecations for 1.10 (#11544)
* Begin basic jsonschema validations of dbt_project.yml (#11505)

* Add jsonschema for validation project file

* Add utility for helping to load jsonschema resources

Currently things are a bit hard coded. We should probably alter this
to be a bit more flexible.

* Begin validating the the `dbt_project.yml` via jsonschema

* Begin emitting deprecation warnings for generic jsonschema violations in dbt_project.yml

* Move from `DbtInternalError` to `DbtRuntimeError` to avoid circular imports

* Add tests for basic jsonschema validation of `dbt_project.yml`

* Add changie doc

* Add seralization test for new deprecation events

* Alter the project jsonschema to not require things that are optional

* Add datafiles to package egg

* Update inclusion of project jsonschema in setup.py to get files correctly

Using the glob spec returns a list of found files. Our previous spec was
raising the error
`error: can't copy 'dbt/resources/input_schemas/project/*.json': doesn't exist or not a regular file`

* Try another approach of adding jsonschema to egg

* Add input_schemas dir to MANIFEST.in spec

* Drop jsonschema inclusion spec from setup.py

* Begin using importlib.resources.files for loading project jsonschema

This doesn't currently work with editable installs :'(

* Use relative paths for loading jsonchemas instead of importlib

Using "importlib" is the blessed way to do this sort of thing. However,
that is failing for us on editable installs. This commit switches us
to using relative paths. Technically doing this has edge cases, however
this is also what we do for the `start_project` used in `dbt init`. So
we're going to do the same, for now. We should revisit this soon.

* Drop requirment of `__additional_properties__` specified by project jsonschema

* Drop requirement for `pre-hook` and `post-hook` specified by project jsonschema

* Reset `active_deprecations` global at the end of tests using `project` fixture

* Begin validation the jsonschema of YAML resource files (#11516)

* Add jsonschema for resources

* Begin jsonschema validating YAML resource files in dbt projects

* Drop `tests` and `data_tests` as required properties of `Columns` and `Models` for resources jsonschema

* Drop `__additional_properties__` as required for `_Metrics` in resources jsonschema

* Drop `post_hook` and `pre_hook` requirement for `__SnapshotsConfig` in resources jsonschema

* Update `_error_path_to_string` to handle empty paths

* Create + use custom Draft7Validator to ignore datetime and date classes

* Break `TestRetry` functional test class into multiple test classes

There was some overflow global state from one test to another which was
causing some of the tests to break.

* Refactor duplicate instances of `jsonschema_validate` to single definition

* Begin testing jsonschema validation of resource YAMLs

* Add changie doc

* Add Deprecation Warnings for Unexpected Jinja Blocks (#11514)

* Add deprecation warnings on unexpected jinja blocks.

* Add changelog entry.

* Add test event.

* Regen proto types.

* Fix event test.

* Add `UnexpectedJinjaBlockDeprecationSummary` and add file context to `UnexpectedJinjaBlockDeprecation` (#11517)

* Add summary event for UnexpectedJinjaBlockDeprecation

* Begin including file information in UnexpectedJinjaBlockDeprecation event

* Add UnexpectedJinjaBlockDeprecationSummary to test_events.py

* Deprecate Custom Top-Level Keys (#11518)

* Add specific deprecation for custom top level keys.

* Add changelog entry

* Add test events

* Add Check for Duplicate YAML Keys (#11510)

* Add functionality to check for duplicate yaml keys, working around PyYAML limitation.

* Fix up some ancient typing issues.

* Ignore typing issue, for now.

* Correct unit tests of `checked_load`

* Add event and deprecation types for duplicate yaml keys

* Begin validating `dbt_project.yml` for duplicate key violations

* Begin checking for duplicate key violations in schema files

* Add test to check duplicate keys are checked in schema files

* Refactor checked_yaml failure handling to reduce duplicate code

* Move `checked_load` utilities to separate file to avoid circular imports

* Handle yaml `start_mark` correctly for top level key errors

* Update changelog

* Fix test.

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>

* Fix issue with YAML anchors in new CheckedLoader class.

* Deprecate having custom keys in config blocks (#11522)

* Add deprecation event for custom keys found in configs

* Begin checking schema files for custom keys found in configs

* Test new CustomConfigInConfigDeprecation event

* Add changie doc

* Add custom config key deprecation events to event serialization test

* Provide message to ValidationError in `SelectorConfig.from_path`

This typing error is unrelated to the changes in this PR. However,
it was failing CI, so I figured it'd be simple to just fix it.

* Add some extra guards around the ValidationFailure `path` and `instance`

* [TIDY-FRIST] Use new `deprecation_tag` (#11524)

* Tidy First: Update deprecation events to use the new `deprecation_tag`

Note did this for a majority of deprecations, but not _all_ deprecations.
That is because not all deprecations were following the pattern. As some
people do string parsing of our logs with regex, altering the deprecations
that weren't doing what `deprecation_tag` does to use `deprecation_tag`
would be a _breaking change_ for those events, thus we did not alter those
events

* Bump minimum dbt-common to `1.22.0`

* Fix tests

* Begin emitting deprecation events for custom properties found in objects (#11526)

* Fix CustomKeyInConfigDeprecationSummary

* Add deprecation type for custom properties in YAML objects

* Begin emitting deprecation events for custom properties found in objects

* Add changie doc

* Add `loaded_at_query` property to `_Sources` definition in jsonschema

This was breaking the test tests/unit/parser/test_parser.py::SchemaParserSourceTest::test_parse_source_custom_freshness_at_source

* Move validating jsonschema of schema files earlier in the process

Previously we were validating the jsonschema of schema files in
`SchemaParser.parse_file`. However, the file is originally loaded in
`yaml_from_file` (which happens before `SchemaParser.parse_file`), and
`yaml_from_file` _modifies_ the loaded dictionary to add some additional
properties. These additional properties violate the jsonschema unfortunately,
and thus we needed to start validating the schema against the jsonschema
before any such modifications.

* Skip parser tests for `model.freshness`

Model freshness never got fully implemented, won't be implemented nor
documented for 1.10. As such we're gonna consider the `model.freshness`
property an "unknown additional property". This is actually good as some
people have "accidentally" defined "freshness" on their models (likely due
to copy/paste of a source), and that property isn't doing anything.

* One single DeprecationsSummary event to rule them all (#11540)

* Begin emitting singular deprecations summary, instead of summary per deprecation type

* Remove concept of deprecation specific summary events in deprecations module

* Drop deprecation summary events that have been added to `feature-branch--11335-deprecations` but not `main`

These are save to drop with no notice because they only ever existed
on a feature branch, never main.

* Correct code numbers for new events on feature-branch that haven't made it to main yet

* Kill `PackageRedirectDeprecationSummary` event, and retire its event code

* add changie doc

* Update jsonschemas to versions 0.0.110 (#11541)

* Update jsonschems to 0.0.110

* Don't allow additional properties in configs

* Don't allow additional top level properties on objects

* Allow for 'loaded_at_query' on Sources and Tables

* Don't allow additional top level properties in schema files

---------

Co-authored-by: Peter Webb <peter.webb@dbtlabs.com>
2025-04-25 14:39:12 -05:00
Gerda Shank
511ff8e0e9 Fix duplicate error when multiple macros in one file with macro patches (#11531) 2025-04-23 17:13:16 -04:00
Emily Rockman
0220941849 fix trigger for artifact review check (#11529)
* fix trigger

* reorg for a single event
2025-04-22 14:14:13 -05:00
Mirna Wong
7594d42e02 add link to yaml tips (#11474)
this pr adds a link to the yaml tips page
2025-04-17 12:17:14 -07:00
Taichi Kato
bd08d13ddc Add pre-commit installation to Docker container for testing compatibility (#11499)
* fix Dockerfile.test

* add change

---------

Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2025-04-17 11:35:09 -07:00
Doug Beatty
5095e8d1e8 Revert "Install pre-commit in Docker container for running tests (#11501)" (#11508)
This reverts commit 2a4da100ff.
2025-04-17 18:29:00 +01:00
Cypher Pepe
a1958c1193 fix: dead link in ARCHITECTURE.md (#11475)
* Update dead link in `ARCHITECTURE.md`

* Update ARCHITECTURE.md

Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>

---------

Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>
2025-04-15 09:24:42 -07:00
Doug Beatty
2a4da100ff Install pre-commit in Docker container for running tests (#11501)
* Install `pre-commit` in Docker container for running tests

* Install `pre-commit` checks in Docker container (if specified)
2025-04-15 08:16:28 -06:00
Jeremy Cohen
9c91ab27b1 Add package 'name' to lock file (#11488)
* Add package 'name' to lock file

* PR feedback + changie

* Fix test + add comment
2025-04-14 22:19:27 -07:00
Quigley Malcolm
3f56cbce5f Behavior flag to handle all warnings with warn_error logic (#11483) 2025-04-11 13:12:24 -05:00
Emily Rockman
7cca8470e0 converts to using custom conclustions, updated triggers (#11481) 2025-04-10 11:34:59 -05:00
Mario Loaiciga
c82ceaaf39 [#9791] Fix datetime.datetime.utcnow() is deprecated as of Python 3.12 (#9839)
* [#9791] Fix datetime.datetime.utcnow() is deprecated as of Python 3.12

* Explicit UTC timezone declaration for instances of datetime.now()

* Keep utcnow() in functional test case to avoid setup errors

* Utilize the more specific datetime class import for microbatch config

* Replace utcnow calls in contracts and artifacts

* Replace utcnow calls in functional and unit test cases

* Test deserialization of compiled run execution results

* Test deserialization of instantiated run execution result

* Code style improvements
2025-04-09 15:03:19 -07:00
Quigley Malcolm
e2e86b788c General Deprecation Warning Improvements (#11466) 2025-04-04 20:38:23 -05:00
Cédric OLIVIER
6b747fe801 fix(dbt-doc): Allow copying asset when dbt docs command is run outside th… (#11219)
* fix(doc): Allow copying asset when dbt docs command is run outside the dbt project

* fix: add test for doc generate from another dir
2025-04-03 12:13:04 -07:00
Kshitij Aranke
9e6facc4d1 Remove homebrew services (#11456) 2025-04-03 14:10:29 +01:00
FishtownBuildBot
5cd966cafa [Automated] Merged prep-release/1.10.0b2_14227037801 into target main during release process 2025-04-02 15:08:30 -04:00
Github Build Bot
47d5d99693 Bumping version to 1.10.0b2 and generate changelog 2025-04-02 18:40:00 +00:00
Chenyu Li
359b195d23 better track of artifacts to upload, more retry (#11449)
* better track of artifact to upload, more retry

* fix-tests
2025-04-01 13:17:46 -07:00
Emily Rockman
2a64b7365f stop manual cleanup because it’s not allowed anymore (#11451) 2025-04-01 14:49:42 -05:00
David Thorn
c6aeb4a291 Stringify profiles_dir in logging event (#11430) 2025-04-01 13:41:14 -04:00
Michelle Ark
5001e4f0e1 Parse catalogs.yml (#11162)
* rough in catalog contracts + requires.catalog

* set catalog integration

* add initial functional test for catalog parsing

* use dbt-adapters.git@feature/externalCatalogConfig

* add concrete catalog integration config

* add requires.catalog to build + reorder requires

* separate data objects from loaders

* improve functional test and fix import

* Discard changes to tests/functional/adapter/simple_seed/test_seed_type_override.py

* Change branch name for dot-adapters

* make table_format and catalog_type strings for now

* remove uv from makefile

* Discard changes to dev-requirements.txt

* Overhaul parsing catalogs.yml

* Use [] instead of None

* update postgres macos action

* Add more tests

* Add changie

* Second round of refactoring

* Address PR comments

---------

Co-authored-by: Colin <colin.rogers@dbtlabs.com>
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2025-04-01 17:00:00 +01:00
Quigley Malcolm
61648b5ed2 Fix microbatch model edge case of having only one batch (that failed) but counting as success (#11446) 2025-04-01 07:11:23 -05:00
Jordi van Dooren
4aa5169212 Remove and correct outdated docs relating to include/ and include/global_project. (#10726)
* Remove and correct outdated  docs.

* correct markdown hyperlink

* Update core/dbt/clients/README.md

Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>

---------

Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>
Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
2025-03-28 19:20:07 -05:00
Jeremy Cohen
729caf0d5e Update issue template to direct adapters issues -> dbt-adapters (#11445) 2025-03-28 21:49:17 +01:00
Doug Beatty
f26d82217e Fix microbatch file naming for compiled code (#11220)
* Functional test for hourly microbatch model

* Use today's date for functional test for hourly microbatch model

* Use today's date for functional test for hourly microbatch model

* Restore to original

* Only use alphanumeric characters within batch ids

* Add tests for batch_id and change expected output for format_batch_start

* Handle missing batch_start

* Revert "Handle missing batch_start"

This reverts commit 65a1db0048. Reverting this because
`batch_start` for `format_batch_start` cannot be `None` and `start_time` for `batch_id`
cannot be `None`.

* Improve BatchSize specific values for `format_batch_start` and `batch_id` methods

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2025-03-28 09:14:38 -05:00
Kshitij Aranke
e264675db7 Add retry to macos postgres setup (#11432)
* Retry macos postgres setup

* Retry command instead of step

* Use setup_db.sh

* Simplify macos postgres setup
2025-03-27 12:58:16 +00:00
Chenyu Li
300aa09fc5 Support artifact upload (#11419)
* wip

* reorganize

* changie

* retry

* nits

* nits

* improve retry, adjust error, adjust host name

* adjust logic

* pr_feedback

* Update .changes/unreleased/Features-20250323-151625.yaml

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2025-03-25 10:24:29 -07:00
Kshitij Aranke
493008417c Revert "Add secondary_profiles to profile.py (#11308)" (#11408)
This reverts commit 71a93b0cd3.
2025-03-21 16:20:47 +00:00
Michelle Ark
906e07c1f2 Add node_checksum to node_info on structured logs (#11368)
* update node_info to include node checksum

* changelog entry

* Discard changes to dev-requirements.txt

---------

Co-authored-by: Chenyu Li <chenyulee777@gmail.com>
Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2025-03-20 15:26:19 -05:00
Kshitij Aranke
6a954e2d24 fix postgres github action using vibe coding (#11409) 2025-03-20 18:29:09 +00:00
Peter Webb
3b724acc54 Add Support for Python 3.13 (#11401)
* Update to latest ddtrace within minor version range.

* Add test coverage for Python 3.13

* Update setup.py to indicate Python 3.13 support.

* Update freezegun version to support Python 3.13

* Add changelog entry.
2025-03-20 09:37:15 -04:00
Peter Webb
b0ca1256ae Macro Annotations and Inference (#11389)
* Default macro argument information from original definitions.

* Add argument type and count warnings behind behavior flag.

* Add changelog entry.

* Make flag test more robust.

* Use a unique event for macro annotation warnings, per review.

* Add event to test list.

* Regenerate core_types_pb2 using protoc 5.28.3

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2025-03-18 13:00:54 -04:00
FishtownBuildBot
9d7820c356 [Automated] Merged prep-release/1.10.0b1_13821590310 into target main during release process 2025-03-12 17:41:19 -04:00
Github Build Bot
1fc193167d Bumping version to 1.10.0b1 and generate changelog 2025-03-12 21:12:13 +00:00
Quigley Malcolm
d9f96a95c1 Remove DBT_EXPERIMENTAL_SAMPLE_MODE env var gating for sample mode (#11382) 2025-03-12 09:27:12 -05:00
amardatar
138a2acf84 Fix parsing error for projects using the new YAML format for snapshots (#11362) 2025-03-10 12:28:22 -04:00
Emily Rockman
88ada4aa31 bump libpq-dev (#11373) 2025-03-07 12:22:09 -06:00
Emily Rockman
77d8e3262a handle ubuntu 20.04 deprecation (#11354)
* update ubuntu 20.04 to 24.04

* updates to ubuntu-latest instead

* try postgres update

* Change owner of db creation script so postgres can run it.

* Add sudos.

* Add debug logging.

* Set execute bit on scripts.

* More debug logging.

* try a service

* clean up and split the integrations tests by os

---------

Co-authored-by: Peter Allen Webb <peter.webb@dbtlabs.com>
2025-03-04 12:41:23 -06:00
Quigley Malcolm
94b6ae13b3 Rewrite execution of microbatch models to avoid blocking the main thread (#11332)
* Push orchestration of batches previously in the `RunTask` into `MicrobatchModelRunner`

* Split `MicrobatchModelRunner` into two separate runners

`MicrobatchModelRunner` is now an orchestrator of `MicrobatchBatchRunner`s, the latter being what handle actual batch execution

* Introduce new `DbtThreadPool` that knows if it's been closed

* Enable `MicrobatchModelRunner` to shutdown gracefully when it detects the thread pool has been closed
2025-03-03 15:21:24 -06:00
Michelle Ark
f7c4c3c9cc add database to ModelNodeArgs in partial parsing test to better reflect prod (#11330) 2025-02-21 16:36:28 -05:00
Kshitij Aranke
71a93b0cd3 Add secondary_profiles to profile.py (#11308)
* Add secondary_profiles to profile.py

* Add more tests for edge cases

* Add changie

* Allow inferring target name and add tests for the same

* Incorporate review feedback

* remove unnecessary nesting

* Use typing_extensions.Self

* use quoted type again

* address pr comments round 2
2025-02-20 16:38:36 +00:00
Emily Rockman
7bdf27af31 Update artifact triggers and concurrency rules (#11327)
* update trigger

* fix concurrency

* remove duplicate counts and check lt gt not eq
2025-02-19 12:26:36 -06:00
Gerda Shank
e60b41d9fa Add invocation_started_at (#11291) 2025-02-18 11:32:04 -05:00
Kshitij Aranke
2ba765d360 Fix #11275: _get_doc_blocks is crashing parsing if .format is called (#11310)
* Fix #11275: get_doc_blocks is crashing parsing

* Add changie
2025-02-18 15:23:28 +00:00
dependabot[bot]
93e27548ce Bump peter-evans/create-pull-request from 6 to 7 (#10680)
* Bump peter-evans/create-pull-request from 6 to 7

Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

* Delete .changes/unreleased/Dependencies-20240909-004501.yaml

remove changelog, not needed

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2025-02-18 08:18:31 -06:00
Quigley Malcolm
aa89740311 Allow sampling from snapshots and of snapshots (#11311)
* Allow for rendering of refs/sources in snapshots to be sampled

Of note the parameterization of `test_resolve_event_time_filter` in
tests/unit/context/test_providers.py is getting large and cumbersome.
It may be time soon to split it into a few distinct tests to facilitate
the necessity of fewer parametrized arguments for a given test.

* Simplify `isinstance` checks when resolving event time filter

Previously we were doing `isintance(a, class1) or (isinstance(a, class2)`
but this can be simplified to `isintance(a, (class1, class2))`. Woops.

* Ensure sampling of refs of snapshots is possible

Notably we didn't have to add `insinstance(self.target, SnapshotConfig)` to the
checks in `resolve_event_time_filter` because `SnapshotConfig` is a subclass
of `NodeConfig`.

* Add changie doc
2025-02-14 16:02:31 -06:00
Quigley Malcolm
aa306693a5 Allow for running sample mode with build command (#11307) 2025-02-14 12:40:13 -06:00
Quigley Malcolm
7041e5822f Ability to sample seeds (#11304)
* Allow for sampling of seeds

* Add changie doc

* Fix seed column types for `TestSampleSeedRefs` tests
2025-02-13 17:12:38 -06:00
Quigley Malcolm
a08255e4cb Combine --sample and --sample-window into one CLI param (#11303)
* Combine `--sample` and `--sample-window` CLI params

* Add changie doc
2025-02-13 15:59:41 -06:00
Emily Rockman
2cde93bf63 Require 2 CODEOWNER reviews for artifact changes (#11256)
* first pass

* resolve TODOs

* updates after testing
2025-02-11 13:06:28 -06:00
Kshitij Aranke
f29836fcf3 Round 2: Add doc_blocks to manifest for nodes and columns (#11294)
* Reapply "Add `doc_blocks` to manifest for nodes and columns (#11224)" (#11283)

This reverts commit 55e0df181f.

* Expand doc_blocks backcompat test

* Refactor to method, add docstring
2025-02-11 16:01:16 +00:00
William Deng
7f32e42230 Update ShowTaskDirect to correctly handle --limit -1 (#11284)
* Update  to support  properly

* changelog
2025-02-10 16:53:04 +00:00
Kshitij Aranke
55e0df181f Revert "Add doc_blocks to manifest for nodes and columns (#11224)" (#11283)
This reverts commit d71f309c1e.
2025-02-07 17:12:06 +00:00
Kshitij Aranke
588cbabe94 Don't automatically run Artifact Schema Check on PRs (#11260)
* Don't automatically run Artifact Schema Check on PRs

* Add branch as argument
2025-02-06 18:46:31 +00:00
Quigley Malcolm
5f873da929 Sample Mode Alpha (#11247)
* Add `--sample` flag to `run` command

* Remove no longer needed `if` statement around EventTimeFilter creation for microbatch models

Upon the initial implementation of microbatch models, the the `start` for a batch was _optional_.
However, in c3d87b89fb they became guaranteed. Thus the if statement
guarding when `start/end` isn't present for microbatch models was no longer actually doing anything.
Hence, the if statement was safe to remove.

* Get sample mode working with `--event-time-start/end`

This is temporary as a POC. In the end, sample mode can't depend on the arguments
`--event-time-start/end` and will need to be split into their own CLI args / project
config, something like `--sample-window`. The issue with using `--event-time-start/end`
is that if people set those in the project configs, then their microbatch models would
_always_ run with those values even outside of sample mode. Despite that, this is a
useful checkpoint even though it will go away.

* Begin using `--sample-window` for sample mode instead of `--event-time-start/end`

Using `--event-time-start/end` for sample mode was conflicting with microbatch models
when _not_ running in sample mode. We will have to do _slightly_ more work to plumb
this new way of specifying sample time to microbatch models.

* Move `SampleWindow` class to `sample_window.py` in `event_time` submodule

This is mostly symbolic. We are going to be adding some utilities for "event_time"
type things, which will all live in the `event_time` submodule. Additionally we plan
to refactor `/incremental/materializations/microbatch.py` into the sub module as well.

* Create an `offset_timestamp` separate from MicrobatchBuilder

The `MicrobatchBuilder.offset_timestamp` _truncates_ the timestamp before
offsetting it. We don't want to do that, we want to offset the "raw" timestamp.
We could have split renamed the microbatch builder function name to
`truncate_and_offset_timestamp` and separated the offset logic into a separate
abstract function. However, the offset logic in the MicrobatchBuilder context
depends on the truncation. We might later on be able to refactor the Microbatch
provided function by instead truncating _after_ offsetting instead of before.
But that is out of scope for this initial work, and we should instead revisit it
later.

* Add `types-python-dateutil` to dev requirements

The previous commit began using a submodule of the dateutil builtin
python library. We weren't previously using this library, and thus didn't
need the type stubs for it. But now that we do use it, we need to have
the type stubs during development.

* Begin supporting microbatch models in sample mode

* Move parsing logic of `SampleWindowType` to `SampleWindow`

* Allow for specificaion of "specific" sample windows

In most cases people will want to set "relative" sample windows, i.e.
"3 days" to sample the last three days. However, there are some cases
where people will want to "specific" sample windows for some chunk of
historic time, i.e. `{'start': '2024-01-01', 'end': '2024-01-31'}`.

* Fix tests of `BaseResolver.resolve_event_time_filter` for sample mode changes

* Add `--no-sample` as it's necessary for retry

* Add guards to accessing of `sample` and `sample_window`

This was necessary because these aren't _always_ available. I had expected
to need to do this after putting the `sample` flag behind an environment
variable (which I haven't done yet). However, we needed to add the guards
sooner because the `render` logic is called multiple times throughout the
dbt process, and earlier on the flags aren't available.

* Gate sample mode functionality via env var `DBT_EXPERIMENTAL_SAMPLE_MODE`

At this point sample mode is _alpha_ and should not be depended upon. To make
this crystal clear we've gated the functionality behind an environment variable.
We'll likely remove this gate in the coming month.

* Add sample mode tests for incremental models

* Add changie doc for sample mode initial implementation

* Fixup sample mode functional tests

I had updated the `later_input_model.sql` to be easier to test with. However,
I didn't correspondingly update the inital `input_model.sql` to match.

* Ensure microbatch creates correct number of batches when sample mode env var isn't present

Previously microbatch was creating the _right_ number of batches when:
1. sample mode _wasn't_ being used
2. sample mode _was_ being used AND the env var was present

Unfortunately sample mode _wasn't_ creating the right number of batches when:
3. sample mode _was_ being used AND the env var _wasn't_ present.

In case (3) sample mode shouldn't be run. Unfortunately we weren't gating sample
mode by the environment variable during batch creation. This lead to a situtation
where in creating batches it was using sample mode but in the rendering of refs
it _wasn't_ using sample mode. Putting it in an inbetween state... This commit
fixes that issue.

Additionally of note, we currently have duplicate sample mode gating logic in the
batch creation as well as in the rendering of refs. We should probably consolidate
this logic into a singular importable function, that way any future changes of how
sample mode is gated is easier to implement.

* Correct comment in SampleWindow post serialization method

* Hide CLI sample mode options

We are doing this _temporarily_ while sample mode as a feature is in
alpha/beta and locked behind an environment variable. When we remove the
environment variable we should also unhide these.
2025-02-03 18:08:28 -06:00
Anders
fdabe9534c post-hoc addition of roadmap (#11259) 2025-01-30 11:48:21 -06:00
Chenyu Li
c0423707b0 loosen validation for freshness (#11253) 2025-01-28 14:20:36 -08:00
Mike Alfare
48d9afa677 point to the dbt-adapters subdirectory post-monorepo migration (#11244) 2025-01-27 19:01:01 -05:00
Kshitij Aranke
d71f309c1e Add doc_blocks to manifest for nodes and columns (#11224) 2025-01-27 19:49:02 +00:00
Emily Rockman
cb323ef78c ADAP-1183: Use the new location for dbt-postgres (#11234)
* use the new location for dbt-postgres

* Update docker/README.md
2025-01-27 10:35:14 -06:00
Quigley Malcolm
22bc1c374e [TIDY FIRST] Click option defintiion organization (alphabetization) (#11236)
* First pass of alphebetizing click option definitions

* Second pass at organizing cli param click options
2025-01-23 13:34:58 -06:00
Kshitij Aranke
31881d2a3b Misc fixes for group info in logging (#11218) 2025-01-21 11:07:25 +00:00
dependabot[bot]
1dcdcd2f52 Bump codecov/codecov-action from 4 to 5 (#11009)
* Bump codecov/codecov-action from 4 to 5

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2025-01-17 11:35:19 -06:00
Gerda Shank
3de3b827bf Fix generic test not null and unique custom configs (#11208) 2025-01-15 17:02:03 -05:00
Kshitij Aranke
8a8857a85c Fix error counts for exposures (#11207) 2025-01-10 21:07:15 +00:00
Gerda Shank
e4d5a4e777 Re-cast definition of unique_key in SnapshotConfig (#11205) 2025-01-09 16:03:17 -05:00
internetcoffeephone
b414ef2cc5 Fix microbatch dbt list --output JSON (#11187)
Currently, running this command on a project containing a microbatch
model results in an error, as microbatch models require a datetime
value in their config which cannot be serialized by the default JSON
serializer.

There already exists a custom JSON serializer within the dbt-core
project that converts datetime to ISO string format. This change uses
the above serializer to resolve the error.
2025-01-09 10:59:49 -05:00
Michelle Ark
57e279cc1b Fix exception type of run operation macro not found (#11193) 2025-01-08 10:17:40 -05:00
Quigley Malcolm
2eb1a5c3ea Always emit warning when microbatch models lack any filtered input node (#11196)
* Update `TestMicrobatchWithInputWithoutEventTime` to check running again raises warning

The first time the project is run, the appropriate warning about inputs is raised. However,
the warning is only being raised when a full parse happens. When partial parsing happens
the warning isn't getting raised. In the next commit we'll fix this issue. This commit updates
the test to show that the second run (with partial parsing) doesn't raise the update, and thus
the test fails.

* Update manifest loading to _always_ check microbatch model inputs

Of note we are at the point where multiple validations are iterating
all of the nodes in a manifest. We should refactor these _soon_ such that
we are not iterating over the same list multiple times.

* Add changie doc
2025-01-08 09:16:30 -06:00
Kshitij Aranke
dcc9a0ca29 Create LogNodeResult event (#11195)
* Create LogNodeResult event

* add msg directly during object creation
2025-01-08 14:14:29 +00:00
Devon Fulcher
892c545985 Meta config for dimensions, measures, and entities (#11190) 2025-01-07 11:17:24 -08:00
Chenyu Li
a8702b8374 add model freshness for adaptive job (#11170) 2025-01-07 10:02:52 -08:00
Daniel Cole
1592987de8 fix: partial parsing - reparse downstream nodes when adding versioning (#11184) 2025-01-07 12:12:47 -05:00
Gerda Shank
710600546a Move initialization of keyword_args up (#11188) 2025-01-06 15:01:21 -05:00
Emily Rockman
0bf38ce294 Revert "Fix circular import (#11137)" (#11175)
This reverts commit 95c090bed0.
2024-12-24 12:18:26 -05:00
Grace Goheen
459d156e85 Roadmap update (Dec 2024) (#11173)
* roadmap post december 2024

* fix yml spacing

* fix code snippet format
2024-12-20 12:56:33 -07:00
dmr
95c090bed0 Fix circular import (#11137)
Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2024-12-19 12:45:42 -08:00
Chenyu Li
f2222d2621 Custom SQL for get source maxLoadedAt (#11163) 2024-12-19 11:49:07 -08:00
Patrick Yost
97ffc37405 Add tags to SavedQueries (#10987) 2024-12-19 10:18:50 -08:00
Gerda Shank
bf18b59845 Fix for dbt_project.yml "tests" config resulting in incorrect state:modified (#11166) 2024-12-18 17:21:45 -05:00
Gerda Shank
88e953e8aa Check modified contracts when doing state:modified (#11161) 2024-12-18 15:40:18 -05:00
Gerda Shank
6076cf7114 Fix yaml snapshot specification with data tests (#11156) 2024-12-18 14:24:27 -05:00
Doug Beatty
a1757934ef Auto-response for bug reports during holiday break (#11152) 2024-12-17 07:47:31 -06:00
Quigley Malcolm
6c61cb7f7a Warn if concurrent_batches config is set to True, but the available adapter doesn't support it (#11145)
* Begin producing warning when attempting to force concurrent batches without adapter support

Batches of microbatch models can be executed sequentially or concurrently. We try to figure out which to do intelligently. As part of that, we implemented an override, the model config `concurrent_batches`, to allow the user to bypass _some_ of our automatic detection. However, a user _cannot_ for batches to run concurrently if the adapter doesn't support concurrent batches (declaring support is opt in). Thus, if an adapter _doesn't_ support running batches concurrently, and a user tries to force concurrent execution via `concurrent_batches`, then we need to warn the user that that isn't happening.

* Add custom event type for warning about invalid `concurrent_batches` config

* Fire `InvalidConcurrentBatchesConfig` warning via `warn_or_error` so it can be silenced
2024-12-16 10:35:08 -06:00
Chenyu Li
4b1f1c4029 add allow additional property for Model and SourceDefinition (#11138) 2024-12-15 23:30:48 -08:00
Kshitij Aranke
7df04b0fe4 Create a no-op exposure runner (#11082) 2024-12-12 15:28:34 +00:00
dave-connors-3
662101590d update adapter version messages (#10919) 2024-12-11 10:56:38 -05:00
Michelle Ark
fc6167a2ee fix MicrobatchExecutionDebug message (#11071)
* fix MicrobatchExecutionDebug message

* Fix typing in `describe_batch` to convince mypy `batch_start` exists when needed

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-12-10 09:59:46 -06:00
Quigley Malcolm
983cbb4f28 Fix microbatch model PartialSuccess status to result in non-zero exit code (#11115)
* Update partial success test to assert partial successes mean that the run failed

* Update results interpretation to include `PartialSuccess` as failure status
2024-12-10 09:48:41 -06:00
Quigley Malcolm
c9582c2323 Fix erroneous additional batch execution (#11113)
* Update single batch test case to check for generic exceptions

* Explicitly skip last final batch execution when there is only one batch

Previously if there was only one batch, we would try to execute _two_
batches. The first batch, and a "last" non existent batch. This would
result in an unhandled exception.

* Changie doc
2024-12-10 09:28:07 -06:00
Michelle Ark
03fdb4c157 Microbatch first last batch serial (#11072)
* microbatch: split out first and last batch to run in serial

* only run pre_hook on first batch, post_hook on last batch

* refactor: internalize parallel to RunTask._submit_batch

* Add optional `force_sequential` to `_submit_batch` to allow for skipping parallelism check

* Force last batch to run sequentially

* Force first batch to run sequentially

* Remove batch_idx check in `should_run_in_parallel`

`should_run_in_parallel` shouldn't, and no longer needs to, take into
consideration where in batch exists in a larger context. The first and
last batch for a microbatch model are now forced to run sequentially
by `handle_microbatch_model`

* Begin skipping batches if first batch fails

* Write custom `on_skip` for `MicrobatchModelRunner` to better handle when batches are skipped

This was necessary specifically because the default on skip set the `X of Y` part
of the skipped log using the `node_index` and the `num_nodes`. If there was 2
nodes and we are on the 4th batch of the second node, we'd get a message like
`SKIPPED 4 of 2...` which didn't make much sense. We're likely in a future commit
going to add a custom event for logging the start, result, and skipping of batches
for better readability of the logs.

* Add microbatch pre-hook, post-hook, and sequential first/last batch tests

* Fix/Add tests around first batch failure vs latter batch failure

* Correct MicrobatchModelRunner.on_skip to handle skipping the entire node

Previously `MicrobatchModelRunner.on_skip` only handled when a _batch_ of
the model was being skipped. However, that method is also used when the
entire microbatch model is being skipped due to an upstream node error. Because
we previously _weren't_ handling this second case, it'd cause an unhandled
runtime exception. Thus, we now need to check whether we're running a batch or not,
and there is no batch, then use the super's on_skip method.

* Correct conditional logic for setting pre- and post-hooks for batches

Previously we were doing an if+elif for setting pre- and post-hooks
for batches, where in the `if` matched if the batch wasn't the first
batch, and the `elif` matched if the batch wasn't the last batch. The
issue with this is that if the `if` was hit, the `elif` _wouldn't_ be hit.
This caused the first batch to appropriately not run the `post-hook` but
then every hook after would run the `post-hook`.

* Add two new event types `LogStartBatch` and `LogBatchResult`

* Update MicrobatchModelRunner to use new batch specific log events

* Fix event testing

* Update microbatch integration tests to catch batch specific event types

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-12-07 12:43:15 -06:00
Peter Webb
afe25a99fe Improve the Performance Characteristics of add_test_edges() (#11092)
* New function to add graph edges.

* Clean up, leave out flag temporarily for testing.

* Put new test edge behavior behind flag.

* Final draft of documentaiton.
2024-12-05 16:33:16 -05:00
Gerda Shank
e32b8a90ac Implement partial parsing for singular data tests configs in yaml files (#11100) 2024-12-05 15:57:56 -05:00
Peter Webb
1472b86ee2 Improve performance of select_children() and select_parents() (#11099)
* Improve performance of select_children() and select_parents()

* Add changelog entry.
2024-12-05 15:03:57 -05:00
William Deng
ff6745c795 Update core to support DSI 0.8.3 (#10990)
Co-authored-by: Courtney Holcomb <courtneyeholcomb@gmail.com>
2024-12-05 09:48:33 -08:00
Thomas Reynaud
fdfe03d561 Access DEBUG flag through get_flags() (#11069) 2024-12-04 11:03:12 -05:00
Michelle Ark
1b7d9b5704 [Tidy first] move microbatch compilation to .compile method (#11063) 2024-11-27 19:08:36 -05:00
Quigley Malcolm
c3d87b89fb Add batch context object to microbatch jinja context (#11031)
* Add `batch_id` to jinja context of microbatch batches

* Add changie doc

* Update `format_batch_start` to assume `batch_start` is always provided

* Add "runtime only" property `batch_context` to `ModelNode`

By it being "runtime only" we mean that it doesn't exist on the artifact
and thus won't be written out to the manifest artifact.

* Begin populating `batch_context` during materialization execution for microbatch batches

* Fix circular import

* Fixup MicrobatchBuilder.batch_id property method

* Ensure MicrobatchModelRunner doesn't double compile batches

We were compiling the node for each batch _twice_. Besides making microbatch
models more expensive than they needed to be, double compiling wasn't
causing any issue. However the first compilation was happening _before_ we
had added the batch context information to the model node for the batch. This
was leading to models which try to access the `batch_context` information on the
model to blow up, which was undesirable. As such, we've now gone and skipped
the first compilation. We've done this similar to how SavedQuery nodes skip
compilation.

* Add `__post_serialize__` method to `BatchContext` to ensure correct dict shape

This is weird, but necessary, I apologize. Mashumaro handles the
dictification of this class via a compile time generated `to_dict`
method based off of the _typing_ of th class. By default `datetime`
types are converted to strings. We don't want that, we want them to
stay datetimes.

* Update tests to check for `batch_context`

* Update `resolve_event_time_filter` to use new `batch_context`

* Stop testing for batchless compiled code for microbatch models

In 45daec72f4 we stopped an extra compilation
that was happening per batch prior to the batch_context being loaded. Stopping
this extra compilation means that compiled sql for the microbatch model without
the event time filter / batch context is no longer produced. We have discussed
this and _believe_ it is okay given that this is a new node type that has not
hit GA yet.

* Rename `ModelNode.batch_context` to `ModelNode.batch`

* Rename `build_batch_context` to `build_jinja_context_for_batch`

The name `build_batch_context` was confusing as
1) We have a `BatchContext` object, which the method was not building
2) The method builds the jinja context for the batch
As such it felt appropriate to rename the method to more accurately
communicate what it does.

* Rename test macro `invalid_batch_context_macro_sql` to `invalid_batch_jinja_context_macro_sql`

This rename was to make it more clear that the jinja context for a
batch was being checked, as a batch_context has a slightly different
connotation.

* Update changie doc
2024-11-27 16:06:41 -06:00
Quigley Malcolm
0f084e16ca Rename internal batch_info variable to previous_batch_results (#11056)
* Rename `batch_info` to `previous_batch_results`

* Exclude `previous_batch_results` from serialization of model node to avoid jinja context bloat

* Drop `previous_batch_results` key from `test_manifest.py` unit tests

In 4050e377ec we began excluding
`previous_batch_results` from the serialized representation of the
ModelNode. As such, we no longer need to check for it in `test_manifest.py`.
2024-11-27 10:46:45 -06:00
Apoorv Mehrotra
3464be7f70 Fixes dbt retry does not respect --threads (#10591) 2024-11-26 11:21:46 -08:00
Gerda Shank
407f6caa1c Pin mashumaro to <3.15 (#11046) 2024-11-25 10:49:17 -05:00
Peter Webb
ad575ec699 Add New Config Properties and Schema for Snapshot Hard Deletes (#10972)
* Add changelog entry.

* Update schemas and test fixtures for new snapshot meta-column

* Add back comment.
2024-11-21 18:15:30 -05:00
Kshitij Aranke
f582ac2488 Fix #11012: Catch DbtRuntimeError for hooks (#11023) 2024-11-21 22:27:45 +00:00
Gerda Shank
f5f0735d00 Bump libpq-dev to 13.18-0+deb11u1 in docker/Dockerfile (#11029) 2024-11-21 17:24:53 -05:00
FishtownBuildBot
3abf575fa6 Cleanup main after cutting new 1.9.latest branch (#11027)
* Clean up changelog on main

* Bumping version to 1.10.0a1

* Code quality cleanup

* add 1.8,1.9 link

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-11-21 15:54:56 -06:00
Michelle Ark
a42303c3af make microbatch models skippable (#11020) 2024-11-21 12:40:37 -05:00
Jeremy Cohen
6fccfe84ea Fix plural of "partial success" (#11002) 2024-11-21 11:33:45 -05:00
Michelle Ark
fd6ec71dab Microbatch parallelism (#10958) 2024-11-21 00:31:47 -05:00
Gerda Shank
ae957599e1 Fix restrict-access to not restrict within same package (#11014) 2024-11-20 19:05:54 -05:00
Gerda Shank
f080346227 Use protobuf >=5.0,<=6.0 (#10969) 2024-11-19 17:37:19 -05:00
Doug Beatty
2a75dd4683 Parseable JSON and text output in quiet mode for dbt show and dbt compile (#9958)
* Allow `dbt show` and `dbt compile` to output JSON without extra logs

* Add `quiet` attribute for ShowNode and CompiledNode messages

* Output of protoc compiler

* Utilize the `quiet` attribute for ShowNode and CompiledNode

* Reuse the `dbt list` approach when the `--quiet` flag is used

* Use PrintEvent to get to stdout even if the logger is set to ERROR

* Functional tests for quiet compile

* Functional tests for quiet show

* Fire event same way regardless if LOG_FORMAT is json or not

* Switch back to firing ShowNode and CompiledNode events

* Make `--inline-direct` to be quiet-compatible

* Temporarily change to dev branch for dbt-common

* Remove extraneous newline

* Functional test for `--quiet` for `--inline-direct` flag

* Update changelog entry

* Update `core_types_pb2.py`

* Restore the original branch in `dev-requirements.txt`

---------

Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2024-11-18 21:37:44 -07:00
Michelle Ark
945539e3ae add index.html to .gitignore (#11008) 2024-11-15 17:31:08 -05:00
bruno messias
84230ce333 fix: override materialization python models (#8538) 2024-11-14 10:31:23 -08:00
Michelle Ark
35c09203ad fire GenericExceptionOnRun for batch-level exception (#11003) 2024-11-14 12:50:16 -05:00
bruno messias
1625eb059a fix: unit tests with versioned refs (#10889) 2024-11-14 11:41:45 -05:00
Kshitij Aranke
2c43af897d Fix #10988: Validate manifest has group_map during group_lookup init (#10995) 2024-11-14 10:59:34 -05:00
Quigley Malcolm
6e1f64f8b4 Bump minimum dbt-adapters requirement to 1.9.0 (#10998)
This is needed for dbt-core + dbt-adapters to work properly in regards to
the microbatch project_flag/behavior flag `require_batched_execution_for_custom_microbatch_strategy`
2024-11-13 13:19:01 -06:00
Michelle Ark
e9a2b548cb fix deprecation firing for microbatch model w custom strategy (#10989) 2024-11-13 13:52:11 -05:00
Michelle Ark
89caa33fb4 Replace environment variable with a project flag to gate microbatch functionality (#10799)
* first pass: replace os env with project flag

* Fix `TestMicrobatchMultipleRetries` to not use `os.env`

* Turn off microbatch project flag for `TestMicrobatchCustomUserStrategyDefault` as it was prior to a9df50f

* Update `BaseMicrobatchTest` to turn on microbatch via project flags

* Add changie doc

* Fix functional tests after merging in main

* Add function to that determines whether the new microbatch functionality should be used

The new microbatch functionality is, unfortunately, potentially dangerous. That is
it adds a new materalization strategy `microbatch` which an end user could have
defined as a custom strategy previously. Additionally we added config keys to nodes,
and as `config` is just a Dict[str, Any], it could contain anything, thus meaning
people could already be using the configs we're adding for different purposes. Thus
we need some intellegent gating. Specifically something that adheres to the following:

cms = Custom Microbatch Strategy
abms = Adapter Builtin Microbatch Strategy
bf = Behavior flag
umb = Use Microbatch Batching
t/f/e = True/False/Error

| cms | abms | bf | umb |
| t   | t    | t  | t   |
| f   | t    | t  | t   |
| t   | f    | t  | t   |
| f   | f    | t  | e   |
| t   | t    | f  | f   |
| f   | t    | f  | t   |
| t   | f    | f  | f   |
| f   | f    | f  | e   |

(The above table assumes that there is a microbatch model present in the project)

In order to achieve this we need to check that either the microbatch behavior
flag is set to true OR microbatch materializaion being used is the _root_ microbatch
materialization (i.e. not custom). The function we added in this commit,
`use_microbatch_batches`, does just that.

* Gate microbatch functionality by `use_microbatch_batches` manifest function

* Rename microbatch behavior flag to `require_batched_execution_for_custom_microbatch_strategy`

* Extract logic of `find_macro_by_name` to `find_macro_candiate_by_name`

In 0349968c61 I had done this for the function
`find_materialization_macro_by_name`, but that wasn't the right function to
do it to, and will be reverted shortly. `find_materialization_macro_by_name`
is used for finding the general materialization macro, whereas `find_macro_by_name`
is more general. For the work we're doing, we need to find the microbatch
macro, which is not a materialization macro.

* Use `find_macro_candidate_by_name` to find the microbatch macro

* Fix microbatch macro locality check to search for `core` locality instead of `root`

Previously were were checking for a locality of `root`. However, a locality
of `root` means it was provided by a `package`. We wnt to check for locality
of `core` which basically means `builtin via dbt-core/adapters`. There is
another locality `imported` which I beleive means it comes from another
package.

* Move the evaluation of `use_microbatch_batches` to the last position in boolean checks

The method `use_microbatch_batches` is always invoked to evaluate an `if`
statement. In most instances, it is part of a logic chain (i.e. there are
multiple things being evaluated in the `if` statement). In `if` statements
where there are multiple things being evaulated, `use_microbatch_batches`
should come _last_ (or as late as possible). This is because it is likely
the most costly thing to evaluate in the logic chain, and thus any shortcuts
cuts via other evaluations in the if statement failing (and thus avoiding
invoking `use_microbatch_batches) is desirable.

* Drop behavior flag setting for BaseMicrobatchTest tests

* Rename 'env_var' to 'project_flag' in test_microbatch.py

* Update microbatch tests to assert when we are/aren't running with batches

* Update `test_resolve_event_time_filter` to use `use_microbatch_batches`

* Fire deprecation warning for custom microbatch macros

* Add microbatch deprecation events to test_events.py

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-11-11 08:49:17 -06:00
Michelle Ark
30b8a92e38 [Fix] assert resolver.model is ModelNode prior to resolving event_time_filter (#10975) 2024-11-06 16:02:41 -05:00
FishtownBuildBot
b95f7a7f2c [Automated] Merged prep-release/1.9.0b4_11711043647 into target main during release process 2024-11-06 15:37:57 -05:00
Michelle Ark
e451a371e6 Ensure inferred primary_key is a List[str] (#10984) 2024-11-06 15:31:54 -05:00
Tim Sturge
81067d4fc4 Support disabling unit tests (#10831) 2024-11-06 15:20:35 -05:00
Github Build Bot
3198ce4809 Bumping version to 1.9.0b4 and generate changelog 2024-11-06 20:08:59 +00:00
Emily Rockman
0c51985c83 upgrade macos version (#10974)
* upgrade to macos-latest

* force link
2024-11-06 11:56:08 -06:00
Devon Fulcher
e26af57989 Behavior change cumulative type param (#10909)
* Behavior change for mf timespinse without yaml config

* Flipping behavior flag causes parse error

* Added more tests

* Appending just one error
2024-11-05 14:22:56 -08:00
Gerda Shank
bdf28d7eff Support --empty option for 'snapshot' command (#10962) 2024-11-01 13:47:28 -04:00
Quigley Malcolm
289d2dd932 Ensure KeyboardInterrupt halts microbatch model execution (#10879) 2024-10-31 13:35:44 -05:00
Devon Fulcher
8a17a0d7e7 Behavior change for mf timespine without yaml configuration (#10857) 2024-10-31 11:40:39 -04:00
Quigley Malcolm
8c6bec4fb5 Emit ArtifactWritten event when artifacts are written (#10940)
* Add new `ArtifactWritten` event

* Emit ArtifactWritten event whenever an artifact is written

* Get artifact_type from class name for ArtifactWritten event

* Add changie docs

* Add test to check that ArtifactWritten events are being emitted

* Regenerate core_types_pb2.py using correct protobuf version

* Regen core_types_pb2 again, using a more correct protoc version
2024-10-30 15:05:50 -05:00
Quigley Malcolm
7f5abdc565 Ensure run results artifact get written during "after run hooks" (#10941)
* Add unit tests to check how `safe_run_hooks` handles exceptions

* Improve exception handling in `get_execution_status`

Previously in `get_execution_status` if a non `DbtRuntimeError` exception was
raised, the finally would be entered, but the `status`/`message` would not be
set, and thus a `status not defined` exception would get raised on attempting
to return. Tangentially, there is another issue where somehow the `node_status`
is becoming `None`. In all my playing with `get_execution_status` I found that
trying to return an undefined variable in the `finally` caused an undefined
variable exception. However, if in some python version, it instead just handed
back `None`, then this fix should also solve that.

* Add changie docs

* Ensure run_results get written if KeyboardInterrupt happens during end run hooks
2024-10-30 14:53:09 -05:00
FishtownBuildBot
f714e84282 [Automated] Merged prep-release/1.9.0b3_11600026512 into target main during release process 2024-10-30 15:39:06 -04:00
Github Build Bot
7f92c6e003 Bumping version to 1.9.0b3 and generate changelog 2024-10-30 19:12:00 +00:00
Quigley Malcolm
8de0229a04 Bump dbt adapters minior minimum to 1.8.0 (#10947)
* Bump minimum dbt-adpaters to 1.8.0

In https://github.com/dbt-labs/dbt-core/pull/10859 we started using the
`get_adapter_run_info` method provided by `dbt-adapters`. However that
function is only available in dbt-adapters >= 1.8.0. Thus 1.8.0 is our
new minimum for dbt-adapters.

* Add changie doc
2024-10-30 14:07:56 -05:00
Quigley Malcolm
dd77210756 Update microbatch end_time to the batch_size ceiling (#10883)
* Add function to MicrobatchBuilder to get ceiling of timestamp by batch_size

* Update `MicrobatchBuilder.build_end_time` to use `ceiling_timestamp`

* fix TestMicrobatchBuilder.test_build_end_time by specifying a BatchSize + asserting actual is a ceiling timestamp

* Add changie

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-10-29 17:26:28 -05:00
Quigley Malcolm
8df5c96f3d Make --event-time-start and --event-time-end mutually required (#10878)
* Stop validating that `--event-time-start` is before "current" time

In the next commit we'll be adding a validation that requires that `--event-time-start`
and `--event-time-end` are mutually required. That is, whenever one is specified,
the other is required. In that world, `--event-time-start` will never need to be compared
against the "current" time, because it'll never be run in conjunction with the "current"
time.

* Validate that `--event-time-start` and `--event-time-end` are mutually present

* Add changie doc for validation changes

* Alter functional microbatch tests to work with updated `event_time_start/end` reqs

We made it such that when `event_time_start` is specified, `event_time_end` must also
be specified (and vice versa). This broke numerous tests, in a few different ways:

1. There were tests that used `--event-time-start` without `--event-time-end` butg
were using event_time_start essentially as the `begin` time for models being initially
built or full refreshed. These tests could simply drop the `--event-time-start` and
instead rely on the `begin` value.

2. There was a test  that was trying to load a subset of the data _excluding_ some
data which would be captured by using `begin`. In this test we added an appropriate
`--event-time-end` as the `--event-time-start` was necessary to statisfy what the
test was testing

3. There was a test which was trying to ensure that two microbatch models would be
given the same "current" time. Because we wanted to ensure the "current" time code
path was used, we couldn't add `--event-time-end` to resolve the problem, thus we
needed to remove the `--event-time-start` that was being used. However, this led to
the test being incredibly slow. This was resolved by switching the relevant microbatch
models from having `batch_size`s of `day` to instead have `year`. This solution should
be good enough for roughly ~40 years? We'll figure out a better solution then, so see ya
in 2064. Assuming I haven't died before my 70th birthday, feel free to ping me to get
this taken care of.

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-10-29 15:31:19 -05:00
Michelle Ark
6b5db1796f raise MicrobatchModelNoEventTimeInputs warning when no microbatch input has event_time config (#10929) 2024-10-29 11:20:44 -04:00
Michelle Ark
3224589fe7 restore dev-requirements for dbt-adapters@main (#10930) 2024-10-28 17:56:30 -04:00
Michelle Ark
b71ceb3166 Microbatch: store model context var as dict, not ModelNode (#10917) 2024-10-28 17:26:49 -04:00
Mila Page
4d4b05effc Add adapter telemetry to snowplow event. (#10859)
* Add adapter telemetry to snowplow event.

* Temporary dev branch switch.

* Set tracking for overrideable adapter method.

* Do safer adapter ref.

* Improve comment.

* Code review comments.

* Don't call the asdict on a dict.

* Bump ci to pull in fix from base adapter.

* Add unit tests for coverage.

* Update field name from base adapter/schema change.

* remove breakpoint.
2024-10-28 14:21:42 -07:00
Michelle Ark
316ecfca28 Fix: Source quoting ignores global configuration (#10905) 2024-10-25 10:33:21 -04:00
Quigley Malcolm
d07bfda9df Change microbatch lookback default from 0 to 1 (#10876)
* Change `lookback` default from `0` to `1`

* Regen jsonschema manifest v12 to include `lookback` default change

* Regen saved state of v12 manifest for functional artifact testing

* Add changie doc for lookback default change
2024-10-24 17:16:32 -05:00
Doug Beatty
8ae689c674 Fix regression when an exposure references a deprecated model (#10915)
* Avoid a KeyError if `child_unique_id` is not found in the dictionary

* Changelog entry

* Functional test when an exposure references a deprecated model
2024-10-24 12:13:56 -06:00
Gerda Shank
bdb79e8626 Partial parse yaml snapshots (#10907) 2024-10-23 14:16:33 -04:00
Gerda Shank
f7b7935a97 Support multiple unique keys in snapshots (#10795) 2024-10-22 14:47:51 -04:00
Peter Webb
3d96b4e36c Loosen Type in TimingInfo (#10897) 2024-10-21 19:01:15 -04:00
Quigley Malcolm
7920b0e71d Update microbatch tests to handle update wherein incremental strategies are always validated (#10884)
dbt-adapters updated the incremental_strategy validation of incremental models such that
the validation now _always_ happens when an incremental model is executed. A test in dbt-core
`TestMicrobatchCustomUserStrategyEnvVarTrueInvalid` was previously set to _expect_ buggy behavior
where an incremental model would succeed on it's "first"/"refresh" run even if it had an invalid
incremental strategy. Thus we needed to update this test in dbt-core to expect the now correct
behavior of incremental model execution time validation
2024-10-21 13:10:00 -07:00
Chenyu Li
a0674db840 exclude hook results from results in on-run-end context (#10885)
* exclude hook results from results in on-run-end context

* changelog

* preserve previous behavior
2024-10-18 15:07:03 -07:00
Kshitij Aranke
ba6c7baf1d [Tidy-First]: Fix timings object for hooks and macros, and make types of timings explicit (#10882)
* [Tidy-First]: Fix `timings` object for hooks and macros, and make types of timings explicit

* cast literal to str

* change test

* change jsonschema to enum

* Discard changes to schemas/dbt/manifest/v12.json

* nits

---------

Co-authored-by: Chenyu Li <chenyu.li@dbtlabs.com>
2024-10-18 17:28:58 -04:00
Paul Yang
8be063502b Add order_by and limit fields to saved queries (#10532)
* Add `order_by` and `limit` fields to saved queries.

* Update JSON schema

* Add change log for #10531.

* Check order by / limit in saved-query parsing test.
2024-10-17 10:54:30 -07:00
Gerda Shank
78c05718c5 Remove Python 3.8 from various places (#10861)
* Remove Python 3.8 from various places

* Add changelog entry.

---------

Co-authored-by: Peter Allen Webb <peter.webb@dbtlabs.com>
2024-10-16 15:15:27 -04:00
Quigley Malcolm
d18f50bbb8 Ensure consistent current_time across microbatch models in an invocation (#10830)
* Add test that checks microbatch models are all operating with the same `current_time`

* Set an `invocated_at` on the `RuntimeConfig` and plumb to `MicrobatchBuilder`

* Add changie doc

* Rename `invocated_at` to `invoked_at`

* Simply conditional logic for setting MicrobatchBuilder.batch_current_time

* Rename `batch_current_time` to `default_end_time` for MicrobatchBuilder
2024-10-15 16:55:19 -05:00
Gerda Shank
ffa75ca9ff Refactor code to properly handle reference deprecations (#10852) 2024-10-15 16:44:27 -04:00
Gerda Shank
8f847167fa Remove dbt_valid_to_current test (will go in adapter zone) (#10854) 2024-10-15 15:39:01 -04:00
Kshitij Aranke
cd6bb9e782 Fix #2578: Allow instances of generic data tests to be documented (#10850) 2024-10-15 18:53:51 +01:00
Kshitij Aranke
ef9abe6c06 [Tidy-First] Fix node_status for hooks (#10845) 2024-10-14 21:27:34 +01:00
Peter Webb
40c350ff21 Add better typing in jinja_static.py (#10835)
* Add better typing in jinja_static.py, remove commented code, clarify names

* Avoid circular dependency.

* Actually work around the circular dependency.
2024-10-11 12:19:37 -04:00
Gerda Shank
c7d8693f70 Enable setting datetime value for dbt_valid_to when the record is current (#10780) 2024-10-10 18:41:03 -04:00
Colin Rogers
6743e32574 add builder config to test node config (#10767)
* add builder config to node config

* add changie

* raise expected exceptions

* add code comment and additional tests

* update tests

* update tests
2024-10-10 14:32:19 -07:00
Quigley Malcolm
f6cdacc61e Stop making microbatch batches with filters that will never have any rows (#10826) 2024-10-08 18:56:10 -05:00
Quigley Malcolm
5db0b81da1 Track batch execution time for microbatch models (#10828)
* Begin testing that microbatch execution times are being tracked and set

* Begin tracking the execution time of batches for microbatch models

* Add changie doc

* Additional assertions in microbatch testing
2024-10-08 14:32:58 -05:00
Quigley Malcolm
fc8eb820aa Validate --event-time-start is before --event-time-end (#10820)
* Validate that `event_time_start` is before `event_time_end` when passed from CLI

Sometimes CLI options have restrictions based on other CLI options. This is the case
for `--event-time-start` and `--event-time-end`. Unfortunately, click doesn't provide
a good way for validating this, at least not that I found. Additionaly I'm not sure
if we have had anything like this previously. In any case, I couldn't find a
centralized validation area for such occurances. Thus I've gone and added one,
`validate_option_interactions`. Long term if more validations are added, we should
add this wrapper to each CLI command. For now I've only added it to the commands that
support `event_time_start` and `event_time_end`, specifically `build` and `run`.

* Add changie doc

* If `--event-time-end` is not specififed, ensure `--event-time-start` is less than the current time

* Fixup error message about event_time_start and event_time_end

* Move logic to validate `event_time` cli flags to `flags.py`

* Update validation of `--event-time-start` against `datetime.now` to use UTC
2024-10-07 14:34:42 -05:00
FishtownBuildBot
fc83f5edfa [Automated] Merged prep-release/1.9.0b2_11213923466 into target main during release process 2024-10-07 07:17:39 -04:00
Github Build Bot
8248d1eb53 Bumping version to 1.9.0b2 and generate changelog 2024-10-07 10:50:33 +00:00
Kshitij Aranke
6b9c1da1ae Revert "state:modified vars, behind "state_modified_compare_vars" behaviour flag" (#10793) (#10813) 2024-10-02 21:00:48 +01:00
Courtney Holcomb
7940ad5c78 Fix case-sensitivity in validation warning (#10807) 2024-10-01 15:40:51 -05:00
Doug Beatty
3ec8fa79bd --inline-direct is an internal CLI flag (#10806) 2024-10-01 14:28:41 -06:00
FishtownBuildBot
396cf2d683 [Automated] Merged prep-release/1.9.0b1_11131260909 into target main during release process 2024-10-01 14:57:06 -04:00
Github Build Bot
87b1143a62 Bumping version to 1.9.0b1 and generate changelog 2024-10-01 18:30:08 +00:00
Kshitij Aranke
75a09621cd [tidy_first] Set default for STATE_MODIFIED_COMPARE_VARS flag, mark TestProjInfo as not a test class (#10805) 2024-10-01 17:27:44 +01:00
Kshitij Aranke
5e9f1b515f [Round 2] Fix #9005: Allow singular tests to be documented in properties.yml (#10792) 2024-10-01 08:05:36 +01:00
Quigley Malcolm
25a68a990c When retrying microbatch models, propagate prior successful state (#10802)
* When retrying microbatch models, propagate prior successful state

* Changie doc for microbatch dbt retry fixes

* Fix test_manifest unit tests for batch_info key

* Add functional test for when a microbatch model has multiple retries

* Add comment about when batch_info will be something other than None
2024-10-01 00:16:05 -05:00
Michelle Ark
a86e2b4ffc [state:modified] store unrendered_database and unrendered_schema on source definition for state:modified comparisons (#10675) 2024-09-30 17:50:33 +02:00
Michelle Ark
94917432f9 add model_incremental_strategy to track_model_run (#10758) 2024-09-30 17:35:33 +02:00
Michelle Ark
d1857b39ca state:modified vars, behind "state_modified_compare_vars" behaviour flag (#10793) 2024-09-30 16:32:37 +02:00
Kshitij Aranke
2ff3f20863 Create skip_nodes_if_on_run_start_fails behavior change flag (#10699) 2024-09-30 13:53:08 +01:00
Courtney Holcomb
5e3d418264 Add new validations for custom granularities (#10789)
* Bump DSI to latest version to ensure mantle users have new validations for custom granularities

* Changelog
2024-09-27 08:37:04 -05:00
Chenyu Li
5d32aa8b62 Revert "Fix #9005: Allow singular tests to be documented in properties.yml" (#10790)
This reverts commit 3ac20ce7a8.
2024-09-26 17:03:10 -07:00
Quigley Malcolm
d8b1bf53f7 [CT-10785] Microbatch models should respect full_refresh model config (#10788)
* Add tests to check how microbatch models respect `full_refresh` model configs

* Fix `_is_incremental` to properly respect `full_refresh` model config

In dbt-core, it is generally expected that values passed via CLI flags take
precedence over model level configs. However, `full_refresh` on a model is an
exception to this rule, where in the model config takes precedence. This
config exists specifically to _prevent_ accidental full refreshes of large
incremental models, as doing so can be costly. **_It is actually best
practice_** to set `full_refresh=False` on incremental models.

Prior to this commit, for microbatch models, the above was not happening. The
CLI flag `--full-refresh` was taking precedence over the model config
`full_refresh`. That meant that if `--full-refresh` was supplied, then the
microbatch model **_would full refresh_** even if `full_refresh=False` was
set on the model. This commit solves that problem.

* Add changie doc for microbatch `full_refresh` config handling
2024-09-26 16:43:14 -05:00
Kshitij Aranke
1076352293 [CORE-388] Add group metadata info to LogModelResult and LogTestResult (#10775) 2024-09-26 20:57:06 +01:00
Gerda Shank
1fe9c1bbfe Attempt to skip saved query processing when no semantic manifest changes (#10784) 2024-09-26 13:04:19 -04:00
Quigley Malcolm
41e4836c0f Fix changie doc for microbatch retry functionality (#10787)
The changie log was referencing the microbatch epic instead of the specific
issues it resolved
2024-09-26 11:34:41 -05:00
Michelle Ark
b590045b9f [state:modified] persist unrendered_config from schema.yml, and more reliably compute unrendered_config from .sql files (#10487) 2024-09-26 16:03:40 +01:00
Quigley Malcolm
1fd4d2eae6 Enable retry support for Microbatch models (#10751)
* Add `PartialSuccess` status type and use it for microbatch models with mixed results

* Handle `PartialSuccess` in `interpret_run_result`

* Add `BatchResults` object to `BaseResult` and begin tracking during microbatch runs

* Ensure batch_results being propagated to `run_results` artifact

* Move `batch_results` from `BaseResult` class to `RunResult` class

* Move `BatchResults` and `BatchType` to separate arifacts file to avoid circular imports

In our next commit we're gonna modify `dbt/contracts/graph/nodes.py` to import the
`BatchType` as part of our work to implement dbt retry for microbatch model nodes.
Unfortunately, the import in `nodes.py` creates a circular dependency because
`dbt/artifacts/schemas/results.py` imports from `nodes.py` and `dbt/artifacts/schemas/run/v5/run.py`
imports from that `results.py`. Thus the new import creates a circular import. Now this
_shouldn't_ be necessary as nothing in artifacts should import from the rest of dbt-core.
However, we do. We should fix this, but this is also out of scope for this segement of work.

* Add `PartialSuccess` as a retry-able status, and use batches to retry microbatch models

* Fix BatchType type so that the first datetime is no longer Optional

* Ensure `PartialSuccess` causes skipping of downstream nodes

* Alter `PartialSuccess` status to be considered an error in `interpret_run_result`

* Update schemas and test artifacts to include new batch_results run results key

* Add functional test to check that 'dbt retry' retries 'PartialSuccess' models

* Update partition failure test to assert downstream models are skipped

* Improve `success`/`error`/`partial success` messaging for microbatch models

* Include `PartialSuccess` in status that `--fail-fast` counts as a failure

* Update `LogModelResult` to handle partial successes

* Update `EndOfRunSummary` to handle partial successes

* Cleanup TODO comment

* Raise a DbtInternalError if we get a batch run result without `batch_results`

* When running a microbatch model with supplied batches, force non full-refresh behavior

This is necessary because of retry. Say on the initial run the microbatch model
succeeds on 97% of it's batches. Then on retry it does the last 3%. If the retry
of the microbatch model executes in full refresh mode it _might_ blow away the
97% of work that has been done. This edge case seems to be adapter specific.

* Only pass batches to retry for microbatch model when there was a PartialSuccess

In the previous commit we made it so that retries of microbatch models wouldn't
run in full refresh mode when the microbatch model to retry has batches already
specified from the prior run. This is only problematic when the run being retried
was a full refresh AND all the batches for a given microbatch model failed. In
that case WE DO want to do a full refresh for the given microbatch model. To better
outline the problem, consider the following:

* a microbatch model had a begin of `2020-01-01` and has been running this way for awhile
* the begin config has changed to `2024-01-01` and  dbt run --full-refresh gets run
* every batch for an microbatch model fails
* on dbt retry the the relation is said to exist, and the now out of range data (2020-01-01 through 2023-12-31) is never purged

To avoid this, all we have to do is ONLY pass the batch information for partially successful microbatch
models. Note: microbatch models only have a partially successful status IFF they have both
successful and failed batches.

* Fix test_manifest unit tests to know about model 'batches' key

* Add some console output assertions to microbatch functional tests

* add batch_results: None to expected_run_results

* Add changie doc for microbatch retry functionality

* maintain protoc version 5.26.1

* Cleanup extraneous comment in LogModelResult

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-09-26 08:45:47 -05:00
Gerda Shank
ac66f91351 Improve performance of infer primary key (#10782) 2024-09-25 18:16:33 -04:00
Peter Webb
359a2c0cc5 Add '--inline-direct' parameter to 'dbt show'. (#10770)
* Add '--inline-direct' parameter to 'dbt show'.

* Add changelog entry.

* Update core/dbt/cli/main.py

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

* Add test of failure for --inline-direct

---------

Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2024-09-25 12:31:05 -04:00
Quigley Malcolm
bbdb98fa5d Microbatch Config Validation (#10752) 2024-09-24 19:56:34 +01:00
Katsuya Shimabukuro
a8d4ba2b4a Fix unit tests for incremental models with alias (#10755) 2024-09-24 17:57:37 +01:00
Doug Beatty
09e973d24a Test case for merge_exclude_columns (#8268)
* Test case for `merge_exclude_columns`

* Update expected output for `merge_exclude_columns`

* Skip TestMergeExcludeColumns test

* Enable this test since PostgreSQL 15+ is available in CI now

* Undo modification to expected output
2024-09-24 08:10:44 -06:00
Michelle Ark
730e40a867 Add required 'begin' config support for microbatch models (#10756) 2024-09-24 14:13:02 +01:00
Michelle Ark
a1e4753020 Write microbatch compiled + run code to separate target files (#10743) 2024-09-24 14:12:44 +01:00
Kshitij Aranke
3ac20ce7a8 Fix #9005: Allow singular tests to be documented in properties.yml (#10744) 2024-09-24 13:15:03 +01:00
Michelle Ark
aa23af98e5 ignore --empty in unit test ref/source calls (#10764) 2024-09-23 23:36:28 +01:00
Peter Webb
46da967115 Allow snapshots to be defined with YAML only. (#10762) 2024-09-23 16:33:30 -04:00
Gerda Shank
db694731c9 Allow configuration of snapshot column names (#10608) 2024-09-20 19:31:05 -04:00
Doug Beatty
7016cd3085 Standardize returning ResourceTypeSelector instances in dbt list and dbt build (#10739)
* Remove duplicated constructor for `ResourceTypeSelector`

* Add type annotation for `ResourceTypeSelector`

* Standardize on constructor for `ResourceTypeSelector` where `include_empty_nodes=True`

* Changelog entry
2024-09-19 16:53:16 -06:00
Doug Beatty
9ca10fbfd9 Enable --resource-type and --exclude-resource-type CLI flags and environment variables for dbt test (#10706)
* Adding logic to TestSelector to remove unit tests if they are in excluded_resource_types

* Adding change log

* Respect `--resource-type` and `--exclude-resource-type` CLI flags and associated environment variables

* Test CLI flag for excluding unit tests for the `dbt test` command

* Satisy isort pre-commit hook

* Fix mypy for positional argument "resource_types" in call to "TestSelector"

* Replace `TestSelector` with `ResourceTypeSelector`

* Add co-author

* Update changelog description

* Add functional tests for new feature

* Compare the actual results, not just the count

* Remove test case covered elsewhere

* Test for `DBT_EXCLUDE_RESOURCE_TYPES` environment variable for `dbt test`

* Update per pre-commit hook

* Restore to original form (until we refactor extraneous `ResourceTypeSelector` references later)

---------

Co-authored-by: Matthew Cooper <asimov.1st@gmail.com>
2024-09-19 16:52:59 -06:00
Quigley Malcolm
3308a4365e Split out model vs microbatch execution (#10737) 2024-09-18 22:13:50 -05:00
Mike Alfare
f8bfd32ed6 fix mock in unit test after removing deprecated snowplow method (#10738) 2024-09-18 15:45:11 -07:00
Mike Alfare
3e437a6734 snowplow is deprecating track_struct_event; use StructuredEvent instead (#10736) 2024-09-18 16:29:18 -04:00
Doug Beatty
9e633f6178 Replace TestSelector with ResourceTypeSelector (#10718)
* [tidy first] Replace `TestSelector` with `ResourceTypeSelector`

* Changelog entry

* Fully preserve current behavior

* Revert "Fully preserve current behavior"

This reverts commit ceecfec96d.
2024-09-18 14:13:50 -06:00
Mike Alfare
d182d06644 Add Snowplow tracking for behavior flags (#10721)
* add behavior deprecation snowplow callback
* update tests for new callback
* update test input with the new required field
2024-09-18 15:09:23 -04:00
Peter Webb
054c6fde37 Fix calls to pre_model_hook which were apparently passing an object of the wrong type. (#10735) 2024-09-18 14:09:02 -04:00
Ly Nguyen
4c326e40b5 Update template for docs issues (#10731)
* Update template for docs issues

* Update .github/workflows/docs-issue.yml

* Update .github/workflows/docs-issue.yml

* Update .github/workflows/docs-issue.yml
2024-09-18 13:02:26 -05:00
Michelle Ark
8fe5ea1ee7 Microbatch: batched execution (#10677)
* initial rough-in with CLI flags

* dbt-adapters testing against event-time-ref-filtering

* fix TestList

* Checkpoint

* fix tests

* add event_time_start params to build

* rename configs

* Gate resolve_event_time_filter via micro batch strategy and fix strptime usage

* Add unit test for resolve_event_time_filter

* Additional unit tests for `resolve_event_time_filter` to ensure lookback + batch_size work

* Remove extraneous comments and print statements from resolve_event_time_filter

* Fixup microbatch functional tests to use microbatch strategy

* Gate microbatch functionality behind env_var while in beta

* Add comment about how _is_incremental should be removed

* Improve `event_time_start/end` cli parameters to auto convert to datetime objects

* for testing: dbt-postgres 'microbatch' strategy

* rough in: chunked backfills

* partial failure of microbatch runs

* decouple run result methods

* initial refactor

* rename configs to __dbt_internal

* update compiled_code in context after re-compilation

* finish rename of context vars

* changelog entry

* fix patch_microbatch_end_time

* refactor into MicrobatchBuilder

* fix provider unit tests + add unit tests for MicrobatchBuilder

* add TestMicrobatchJinjaContextVarsAvailable

* unit test offset + truncate timestamp methods

* Remove pairing.md file

* Add tying to microbatch specific functions added in `task/run.py`

* Add doc strings to microbatch.py functions and classes

* Set microbatch node status to `ERROR` if all batches for node failed

* Fire an event for batch exceptions instead of directly printing

* Fix firing of failed microbatch log event

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-09-18 11:46:06 -05:00
Doug Beatty
16f5023f4d Fix --resource-type test for dbt list and dbt build (#10730)
* Update functional tests to cover this case

* Revert "Update functional tests to cover this case"

This reverts commit 4c78e816f6.

* New functional tests to cover the resource_type config

* Separate data tests from unit tests for `resource_types` config of `dbt list` and `dbt build`

* Changelog entry
2024-09-18 10:21:14 -06:00
Courtney Holcomb
c6b8f7e595 Add custom granularities to YAML spec (#10664)
* Add custom granularities to YAML spec

* Changelog

* Add tests

* Remove unneeded duplicate classes
2024-09-17 13:02:56 -05:00
Michelle Ark
77aeb3ea68 Add functional tests for custom incremental strategies names 'microbatch' (#10716)
* Add functional tests for custom incremental strategies names 'microbatch'

* Point dev-requirement of `dbt-adapters` back to the main branch

The associated branch/PR in `dbt-adapters` that we were previously
pointing to has been merged. Thus we can point back to `main` again.

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-09-16 14:38:14 -05:00
Emily Rockman
1e20772d33 Update docs-issue.yml (#10720) 2024-09-16 11:59:15 -05:00
Doug Beatty
8ce2c46a2f [tidy first] Fix a couple misspellings (#10717) 2024-09-16 10:02:30 -06:00
Gerda Shank
aeaaedcaa1 Update docs and title for schemas.getdbt.com changes (#10719) 2024-09-16 11:11:08 -04:00
Michelle Ark
6c111f2e31 add patch_microbatch_event_time (#10712) 2024-09-13 22:01:31 -04:00
Michelle Ark
139b9ac54f delete extraneous EventCatcher (#10710) 2024-09-13 18:19:33 -04:00
Michelle Ark
cc8541c05f Microbatch: event_time ref + source filtering (#10594) 2024-09-12 18:16:04 -04:00
Michelle Ark
ab500a9709 install postgres-16 in CI (#10687) 2024-09-11 12:43:33 -04:00
Mike Alfare
1d3d315249 Add flags from dbt_project.yml to the Project and RuntimeConfig objects (#10644)
* add flags from dbt_project.yml to the Project and RuntimeConfig objects
2024-09-06 15:42:29 -04:00
Gerda Shank
b35ad46e3f Remove deprecation warning to change "tests:" config to "data_tests:" (#10670) 2024-09-05 20:35:28 -04:00
Gerda Shank
c28cb92af5 Warn if timestamp updated_at field uses incompatible timestamp (#10352)
Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-09-04 14:42:14 -04:00
RyoAriyama
b56d96df5e Fix/changes current working dir when using a dbt project dir (#9596)
* made class changing directory a context manager.

* add change log

* fix conflict

* made base as a context manager

* add assertion

* Remove index.html

* add it test to testDbtRunner

* fix deps args order

* fix test

---------

Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
Co-authored-by: Chenyu Li <chenyu.li@dbtlabs.com>
2024-09-03 13:41:53 -07:00
Jeremy Cohen
37d382c8e7 Filter out empty nodes after graph selection (#10580)
* Add unit test

* Filter out empty nodes after graph selection

* Add changie

* Add --indirect-selection empty check to unit test
2024-09-03 18:48:03 +02:00
Gerda Shank
9b7f4ff842 use full manifest in adapter instead of macro_manifest (#10609)
* use full manifest in adapter instead of macro_manifest

* Add test case

* Add changelog entry

* Remove commented code.

---------

Co-authored-by: Peter Allen Webb <peter.webb@dbtlabs.com>
2024-08-29 11:32:30 -04:00
Emily Rockman
555ff8091f update dep for psycopg (#10633) 2024-08-29 09:44:49 -05:00
Emily Rockman
98fddcf54f rework test to ignore utils version (#10625) 2024-08-28 15:25:09 -05:00
Emily Rockman
d652359c61 add typing (#10619) 2024-08-28 13:26:18 -05:00
Peter Webb
f7d21e012e Add More Typing to the dbt.task Module (#10622)
* Add typing to task module.

* More typing in the task module

* Still more types for task module
2024-08-28 11:18:01 -04:00
Quigley Malcolm
e1fa461186 [TIDY FIRST] Fix typing issues in dbt/core/tasks/clean.py (#10617) 2024-08-27 17:37:16 -05:00
Quigley Malcolm
1153597970 Fix typing errors in core/dbt/contracts/sql.py (#10615) 2024-08-27 17:37:00 -05:00
Quigley Malcolm
09f9febc25 [TIDY FIRST] Fix core/dbt/version.py type hinting (#10613) 2024-08-27 17:36:31 -05:00
Doug Beatty
22181409f6 Enable calling a macro in a pre- or post-hook config in properties.yml (#10603)
* Tests for calling a macro in a pre- or post-hook config in properties.yml

* Late render pre- and post-hooks configs in properties / schema YAML files

* Changelog entry
2024-08-27 11:08:56 -06:00
William Deng
f25a474f75 updated saved query tests and fixtures (#10610) 2024-08-26 17:39:35 -04:00
aliceliu
3c55806203 Fix state:modified check for exports (#10565) 2024-08-23 15:22:38 -04:00
Gerda Shank
bba020fcc0 Add test for source names with quotes (#10588) 2024-08-21 11:57:34 -04:00
Courtney Holcomb
84eb0ff672 Bump DSI version (#10585)
* Bump DSI version

* Changelog
2024-08-20 16:37:52 -04:00
Kshitij Aranke
3695698e22 [CORE-364] Add group info to RunResultError, RunResultFailure, RunResultWarning log lines (#10535) 2024-08-19 11:26:00 -07:00
Courtney Holcomb
9ca1bc5b4c Remove unneeded TODO (#10568) 2024-08-14 14:49:47 -07:00
Gerda Shank
5f66678f6d Incremental models with a contract don't need their columns modified (#10371) 2024-08-14 08:15:25 -07:00
Jean Cochrane
63262e93cb Use model alias for the CTE identifier generated during ephemeral materialization (#10290)
* Use alias instead of name when adding ephemeral model prefixes

* Adjust TestCustomSchemaWithCustomMacroFromModelName to test ephemeral models

* Add changelog entry for ephemeral model CTE identifier fix

* Reference model.identifier and model.name where appropriate to resolve typing errors

* Move test for ephemeral model with alias to dedicated test in test_compile.py
2024-08-09 15:00:55 -07:00
Tobie Tusing
374412af53 Improve tree traversal of select_children (#10526)
* update children search

* update search to include children in original selector

* add changie

* remove unused function

* fix wrong function call

* fix depth
2024-08-09 17:38:15 -04:00
Kshitij Aranke
47848b8ea8 Fix add_ephemeral_prefix to identifier instead of name (#10550) 2024-08-09 13:58:37 -05:00
Michelle Ark
3d09872a56 reset deprecations prior to usage in unit tests (#10545) 2024-08-08 12:25:22 -04:00
Colin Rogers
dfa7d06526 Revert "Remove Undocumented Property" (#10544)
* Revert "Remove undocumented property which does not pass mypy checks after an…"

This reverts commit 21a46332f1.

* add code comment
2024-08-07 20:01:55 -07:00
aliceliu
7f57dd5a30 Support using the measure label when using create_metric option (#10536) 2024-08-07 15:06:46 -05:00
Peter Webb
56bfbeaedd Depend on snowplow-tracker rather than our old fork, minimal-snowplow-tracker. (#10530) 2024-08-07 14:55:42 -04:00
Michelle Ark
1dd26e79af deprecations.buffer: respect --quiet and --warn-error-options for deprecations (#10534) 2024-08-07 11:16:40 -04:00
Quigley Malcolm
86223609dd Parameterized testing examples utilizing happy path fixture (#10480)
* sketch

* Bring back the happy path fixture snapshot file

The commit c783a86 removed the snapshot file from the happy path fixture.
This was done because the snapshot was breaking the tests we were adding,
`test_run_commands`. However this broke `test_ls` in `test_list.py`. In order
to move forward, we need everything to be working. Maybe the idea was to delete
the `test_list.py` file, however that is not noted anywhere, and was not done.
Thus this commit ensures that test is not broken nor or new tests.

* Create conftest for `functional` tests so that happy path fixtures are accessible

* Format `test_commands.py` and update imports to appease pre-commit hooks

* Parametrize `test_run_command` to make it easier to see which command is failing (if any)

* Update the setup for `TestRunCommands.test_run_command` to be more formulaic

* Add test to ensure resource types are selectable

* Fix docstring formatting in TestRunCommands

* Fixup documentation for test_commands.py

---------

Co-authored-by: Chenyu Li <chenyu.li@dbtlabs.com>
2024-08-07 10:05:25 -05:00
Peter Webb
21a46332f1 Remove undocumented property which does not pass mypy checks after annotations in dbt-common. (#10529) 2024-08-06 11:04:54 -04:00
Michelle Ark
ff2726c3b5 more defensive node.all_constraints access (#10508) 2024-07-31 20:02:27 -04:00
Courtney Holcomb
014444dc18 Bump DSI version to release new time spine validations (#10507) 2024-07-30 15:52:40 -07:00
Kshitij Aranke
25c2042dc9 Bump dbt-adapters to 1.3.0 (#10499) 2024-07-29 18:57:24 +01:00
Courtney Holcomb
0a160fc27a Support time spine configs for sub-daily granularity (#10483) 2024-07-29 13:39:39 -04:00
Michelle Ark
c598741262 Bump dbt common 1.6 (#10489) 2024-07-26 13:51:34 -04:00
Courtney Holcomb
f9c2b9398f Remove newlines from JSON schema files (#10486) 2024-07-26 13:36:13 -04:00
Michelle Ark
cab6dabbc7 parse + compile constraint.to and constraint.to_columns on foreign key constraints (#10414) 2024-07-25 10:56:17 -04:00
nakamichi
e1621ebc54 Fix typing for artifact schemas (#10443) 2024-07-24 18:22:21 -04:00
Michelle Ark
cd90d4493c add predicate to EventCatcher test util (#10482) 2024-07-23 17:55:30 -04:00
Kshitij Aranke
560d151dcd [Tidy First] Update PR template punctuation (#10479) 2024-07-23 19:32:52 +01:00
Doug Beatty
229c537748 Update pytest examples for contributors (#10478) 2024-07-23 11:42:31 -06:00
Mila Page
79ad0a3243 Support for redshift 821 (#10448)
* Add breakpoint.

* Move breakpoint.

* Add fix

* Add changelog.

* Avoid sorting for the string case.

* Add unit test.

* Fix test.

* add good unit tests for coverage of sort method.

* add sql format coverage.

* Modify behavior to log a warning and proceed.

* code review comments.

---------

Co-authored-by: Mila Page <versusfacit@users.noreply.github.com>
2024-07-22 13:54:46 -07:00
Gerda Shank
c668846404 Modify snapshot config to allow using schema/database/alias macros (#10439) 2024-07-18 15:56:51 -04:00
igorvoltaic
c4958de166 test: cover additional listagg cases (#10445)
* test: cover addidtional listagg cases

* fix embarrasement

---------

Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
2024-07-18 10:42:22 -04:00
Gerda Shank
33161a3035 Fix warn error options being invalid when warn or error set to none (#10453)
* Fix exclusive_primary_alt_value_setting to set warn_error_options correctly

* Add test

* Changie

* Fix unit test

* Replace conversion method

* Refactor normalize_warn_error_options
2024-07-17 14:13:34 -07:00
Gerda Shank
471b816dcd Fix multiple semantic models with generated metrics (#10451) 2024-07-17 16:09:06 -04:00
Michelle Ark
bef2d20c21 bump black in dev-requirements and pre-commit-config (#10407) 2024-07-17 12:01:14 -04:00
Michelle Ark
2a26fabfdf [tidy first] generate protos w protoc version 5.26.1 (#10456) 2024-07-17 10:35:38 -04:00
Courtney Holcomb
4c7d922a6d Add Metric.time_granularity to metric spec (#10378) 2024-07-16 13:35:20 -04:00
Michelle Ark
b03291548a update test__model_contract_true (#10449) 2024-07-16 11:32:00 -04:00
Chenyu Li
a7af3b3831 Revert "Support for redshift 821" (#10446) 2024-07-15 17:21:38 +01:00
Mila Page
6e4564ab05 Support for redshift 821 (#10366)
* Add changelog.

* Avoid sorting for the string case.

* add good unit tests for coverage of sort method.

* add sql format coverage.

---------

Co-authored-by: Mila Page <versusfacit@users.noreply.github.com>
2024-07-12 14:55:34 -07:00
Mirna Wong
1aeff2c58f GitHub issue template for documentation internal to dbt-core (#10404) 2024-07-11 18:38:25 +01:00
Gerda Shank
601fee0d5f Global CLI flag should override env var flag (#10423) 2024-07-10 15:25:19 -04:00
Emily Rockman
88b8b10df1 Update README.md (#10420)
* Update README.md

* update workflow
2024-07-08 20:44:36 -05:00
Gerda Shank
4ea0e1007c [Tidy first] Add some mypy types to parser files (#10380) 2024-07-08 10:19:39 -04:00
Gerda Shank
a309283a7c Add additional logging information to capture skipped ephemeral model info (#10390) 2024-07-03 12:28:34 -04:00
Emily Rockman
b10fa79ae8 add testing slack notification (#10400) 2024-07-03 09:10:27 -05:00
Quigley Malcolm
37e2725038 [TIDY-FIRST] Fix isort for dbt-semantic-interfaces (#10394)
* Correct `isort` configuration to include dbt-semantic-interfaces as internal

We thought we were already doing this. However, we accidentally missed the last
`s` of `dbt-semantic-interfaces`, so imports from dbt-semantic-interfaces were not
being identified as an internal package by isort. This fixes that.

* Run isort using updated configs to mark `dbt-semantic-interfaces` as included
2024-07-02 11:36:27 -07:00
Emily Rockman
37fd299ad0 skip more tests (#10392) 2024-07-02 10:31:16 -05:00
Courtney Holcomb
a94027acea Add CumulativeTypeParams & sub-daily granularities to semantic manifest (#10350) 2024-07-01 14:54:23 -07:00
Gerda Shank
b59c9075e2 Tweak project-test-config deprecation test for misc deprecations (#10391) 2024-07-01 14:52:14 -04:00
Gerda Shank
c215697a02 Limit data test deprecation warning to root_project (#10375) 2024-06-28 09:43:55 -04:00
aliceliu
d936a630c1 Make time spine model name a constant (#10363) 2024-06-25 16:11:49 -07:00
Quigley Malcolm
11ee2b9c42 Fix setting silence of warn_error_options via dbt_project.yaml flags (#10359)
* Fix `test_can_silence` tests in `test_warn_error_options.py` to ensure silencing

We're fixing an issue wherein `silence` specifications in the `dbt_project.yaml`
weren't being respected. This was odd since we had tests specifically for this.
It turns out the tests were broken. Essentially the warning was instead being raised
as an error due to `include: 'all'`. Then because it was being raised as an error,
the event wasn't going through the logger. We were only asserting in these tests that
the silenced event wasn't going through the logger (which it wasn't) so everything
"appeared" to be working. Unfortunately everything wasn't actually working. This is now
highlighted because `test_warn_error_options::TestWarnErrorOptionsFromProject:test_can_silence`
is now failing with this commit.

* Fix setting `warn_error_options` via `dbt_project.yaml` flags.

Back when I did the work for #10058 (specifically c52d6531) I thought that
the `warn_error_options` would automatically be converted from the yaml
to the `WarnErrorOptions` object as we were building the `ProjectFlags` object,
which holds `warn_error_options`, via `ProjectFlags.from_dict`. And I thought
this was validated by the `test_can_silence` test added in c52d6531. However,
there were two problems:

1. The definition of `warn_error_options` on `PrjectFlags` is a dict, not a
`WarnErrorOptions` object
2. The `test_can_silence` test was broken, and not testing what I thought

The quick fix (this commit) is to ensure `silence` is passed to `WarnErrorOptions`
instantiation in `dbt.cli.flags.convert_config`. The better fix would be to make
the `warn_error_options` of `ProjectFlags` a `WarnErrorOptions` object instead of
a dict. However, to do this we first need to update dbt-common's `WarnErrorOptions`
definition to default `include` to an empty list. Doing so would allow us to get rid
of `convert_config` entirely.
2024-06-25 13:53:18 -07:00
Emily Rockman
64c59476f4 pin versions so CI and local dev match (#10358) 2024-06-24 11:25:48 -05:00
Chenyu Li
2bae05b8ed Configure Codecov to check by components 2024-06-21 15:11:59 -07:00
Emily Rockman
ca163c3d6e skip test until we can rewrite the strategy (#10348) 2024-06-20 17:22:58 -05:00
Quigley Malcolm
9a796aa202 Add unit tests for Graph class (#10338) 2024-06-20 13:17:21 -07:00
Emily Rockman
51ff85bb2d Support DIFF as a recording mode (#10263)
* add diffing

* WIP

* change file name

* Update core/dbt/cli/requires.py
2024-06-20 14:02:28 -05:00
Gerda Shank
d389ff1450 Remove unnecessary IntermediateSnapshotNode and EmptySnapshotConfig (#10332) 2024-06-19 16:21:03 -04:00
Kshitij Aranke
4415731da4 Add get_catalog_for_single_relation to MockAdapter (#10336) 2024-06-18 22:09:44 +01:00
Michelle Ark
0fdc83af9d move non-circular import to top of manifest.py (#10333) 2024-06-18 16:57:12 -04:00
Gerda Shank
71a8a41104 Implement state:modified for saved queries (#10295) 2024-06-17 23:18:56 -04:00
Quigley Malcolm
da19d7ba9f Add initial unit tests for ModelRunner class (#10196)
* Add unit test for `ModelRunner.print_result_line`

* Add (and skip) unit test for `ModelRunner.execute`

An attempt at testing `ModelRunner.execute`. We should probably also be
asserting that the model has been executed. However before we could get there,
we're running into runtime errors during `ModelRunner.execute`. Currently the
struggle is ensuring the adapter exists in the global factory when `execute`
goes looking for. The error we're getting looks like the following:
```
    def test_execute(self, table_model: ModelNode, manifest: Manifest, model_runner: ModelRunner) -> None:
>       model_runner.execute(model=table_model, manifest=manifest)

tests/unit/task/test_run.py:121:
----
core/dbt/task/run.py:259: in execute
    context = generate_runtime_model_context(model, self.config, manifest)
core/dbt/context/providers.py:1636: in generate_runtime_model_context
    ctx = ModelContext(model, config, manifest, RuntimeProvider(), None)
core/dbt/context/providers.py:834: in __init__
    self.adapter = get_adapter(self.config)
venv/lib/python3.10/site-packages/dbt/adapters/factory.py:207: in get_adapter
    return FACTORY.lookup_adapter(config.credentials.type)
---`
self = <dbt.adapters.factory.AdapterContainer object at 0x106e73280>, adapter_name = 'postgres'

    def lookup_adapter(self, adapter_name: str) -> Adapter:
>       return self.adapters[adapter_name]
E       KeyError: 'postgres'

venv/lib/python3.10/site-packages/dbt/adapters/factory.py:132: KeyError
```

* Add `postgres_adapter` fixture for use in `TestModelRunner`

Previously we were running into an issue where the during `ModelRunner.execute`
the mock_adapter we were using wouldn't be found in the global adapter
factory. We've gotten past this error by supply a "real" adapter, a
`PostgresAdapter` instance. However we're now running into a new error
in which the materialization macro can't be found. This error looks like
```
model_runner = <dbt.task.run.ModelRunner object at 0x106746650>

    def test_execute(
        self, table_model: ModelNode, manifest: Manifest, model_runner: ModelRunner
    ) -> None:
>       model_runner.execute(model=table_model, manifest=manifest)

tests/unit/task/test_run.py:129:
----
self = <dbt.task.run.ModelRunner object at 0x106746650>
model = ModelNode(database='dbt', schema='dbt_schema', name='table_model', resource_type=<NodeType.Model: 'model'>, package_na...ected'>, constraints=[], version=None, latest_version=None, deprecation_date=None, defer_relation=None, primary_key=[])
manifest = Manifest(nodes={'seed.pkg.seed': SeedNode(database='dbt', schema='dbt_schema', name='seed', resource_type=<NodeType.Se...s(show=True, node_color=None), patch_path=None, arguments=[], created_at=1718229810.21914, supported_languages=None)}})

    def execute(self, model, manifest):
        context = generate_runtime_model_context(model, self.config, manifest)

        materialization_macro = manifest.find_materialization_macro_by_name(
            self.config.project_name, model.get_materialization(), self.adapter.type()
        )

        if materialization_macro is None:
>           raise MissingMaterializationError(
                materialization=model.get_materialization(), adapter_type=self.adapter.type()
            )
E           dbt.adapters.exceptions.compilation.MissingMaterializationError: Compilation Error
E             No materialization 'table' was found for adapter postgres! (searched types 'default' and 'postgres')

core/dbt/task/run.py:266: MissingMaterializationError
```

* Add spoofed macro fixture `materialization_table_default` for `test_execute` test

Previously the `TestModelRunner:test_execute` test was running into a runtime error
do to the macro `materialization_table_default` macro not existing in the project. This
commit adds that macro to the project (though it should ideally get loaded via interactions
between the manifest and adapter). Manually adding it resolved our previous issue, but created
a new one. The macro appears to not be properly loaded into the manifest, and thus isn't
discoverable later on when getting the macros for the jinja context. This leads to an error
that looks like the following:
```
model_runner = <dbt.task.run.ModelRunner object at 0x1080a4f70>

    def test_execute(
        self, table_model: ModelNode, manifest: Manifest, model_runner: ModelRunner
    ) -> None:
>       model_runner.execute(model=table_model, manifest=manifest)

tests/unit/task/test_run.py:129:
----
core/dbt/task/run.py:287: in execute
    result = MacroGenerator(
core/dbt/clients/jinja.py:82: in __call__
    return self.call_macro(*args, **kwargs)
venv/lib/python3.10/site-packages/dbt_common/clients/jinja.py:294: in call_macro
    macro = self.get_macro()
---
self = <dbt.clients.jinja.MacroGenerator object at 0x1080f3130>

    def get_macro(self):
        name = self.get_name()
        template = self.get_template()
        # make the module. previously we set both vars and local, but that's
        # redundant: They both end up in the same place
        # make_module is in jinja2.environment. It returns a TemplateModule
        module = template.make_module(vars=self.context, shared=False)
>       macro = module.__dict__[get_dbt_macro_name(name)]
E       KeyError: 'dbt_macro__materialization_table_default'

venv/lib/python3.10/site-packages/dbt_common/clients/jinja.py:277: KeyError
```

It's becoming apparent that we need to find a better way to either mock or legitimately
load the default and adapter macros. At this point I think I've exausted the time box
I should be using to figure out if testing the `ModelRunner` class is possible currently,
with the result being more work has yet to be done.

* Begin adding the `LogModelResult` event catcher to event manager class fixture
2024-06-17 17:06:52 -07:00
Michelle Ark
1475abb1cb add empty to context flags (#10315) 2024-06-17 12:09:45 -04:00
Matthew McKnight
27b2f965dd Call adapter.pre_model_hook + adapter.post_model_hook within tests (#10258)
* init push for issue 10198

* add changelog

* add unit tests based on michelle example

* add data_tests, and post_hook unit tests

* pull creating macro_func out of try call

* revert last commit

* pull macro_func definition back out of try

* update code formatting
2024-06-14 14:17:09 -05:00
Quigley Malcolm
100352d6b4 Stop mis-identifying unit_test config paths in dbt_project.yaml as unused (#10312)
* Add basic semantic layer fixture nodes to unit test `manifest` fixture

We're doing this in preperation to a for a unit test which will be testing
these nodes (as well as others) and thus we want them in the manifest.

* Add `WhereFilterInteresection` to `QueryParams` of `saved_query` fixture

In the previous commit, 58990aa450, we added
the `saved_query` fixture to the `manifest` fixture. This broke the test
`tests/unit/parser/test_manifest.py::TestPartialParse::test_partial_parse_by_version`.
It broke because the `Manifest.deepcopy` manifest basically dictifies things. When we were
dictifying the `QueryParams` of the `saved_query` before, the `where` key was getting
dropped because it was `None`. We'd then run into a runtime error on instantiation of the
`QueryParams` because although `where` is declared as _optional_, we don't set a default
value for it. And thus, kaboom :(

We should probably provide a default value for `where`. However that is out of scope
for this branch of work.

* Fix `test_select_fqn` to account for newly included semantic model

In 58990aa450 we added a semantic model
to the `manifest` fixture. This broke the test
`tests/unit/graph/test_selector_methods.py::test_select_fqn` because in
the test it selects nodes based on the string `*.*.*_model`. The newly
added semantic model matches this, and thus needed to be added to the
expected results.

* Add unit tests for `_warn_for_unused_resource_config_paths` method

Note: At this point the test when run with for a `unit_test` config
taht should be considered used, fails. This is because it is not being
properly identified as used.

* Include `unit_tests` in `Manifest.get_resouce_fqns`

Because `unit_tests` weren't being included in calls to `Manifest.get_resource.fqns`,
it always appeared to `_warn_for_unused_resource_config_paths` that there were no
unit tests in the manifest. Because of this `_warn_for_unused_resource_config_paths` thought
that _any_ `unit_test` config in `dbt_project.yaml` was unused.
2024-06-14 09:27:45 -07:00
FishtownBuildBot
8ee8b2560a Add most recent dbt-docs changes (#10307)
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2024-06-14 16:29:11 +01:00
Michelle Ark
d4a6482091 deflake source freshness hooks test (#10308) 2024-06-13 11:25:48 -04:00
Chenyu Li
8639290108 update on_skip to adjust for node that do not have schema (#10302)
* update on_skip to adjust for node that do not have schema

* changelog
2024-06-12 14:16:54 -07:00
Chenyu Li
e699f5d042 create a happy path project fixture (#10291) 2024-06-11 14:41:11 -07:00
Kshitij Aranke
e977b3eee5 Move CatalogKey, ColumnMetadata, ColumnMap, CatalogTable to dbt-common (#10253) 2024-06-11 05:07:57 +01:00
Gerda Shank
c5be8e2a93 Improve handling of error when loading schema file which is a list (#10285) 2024-06-10 15:53:24 -04:00
Quigley Malcolm
bff116dbed Migrate selector tests to pytest (#10282)
* Rename `maniest` fixture in `test_selector` to `mock_manifest`

We have a globally available `manifest` fixture in our unit tests. In the
coming commits we're going to add tests to the file which use the gloablly
available `manifest` fixture. Prior to this commit, the locally defined
`manifest` fixture was taking precidence. To get around this, the easiest
solution was to rename the locally defined fixture.

I had tried to isolate the locally defined fixture by moving it, and the relevant
tests to a test class like `TestNodeSelector`. However because of _how_ the relevant
tests were parameterized, this proved difficult. Basically for readability we define
a variable which holds a list of all the parameterization variables. By moving to a
test class, the definition of the variables would have had to be defined directly in
the parameterization macro call. Although possible, it made the readability slighty
worse. It might be worth doing anyway in the long run, but instead I used a less heavy
handed alternative (already described)

* Improve type hinting in `tests/unit/utils/manifest.py`

* Ensure `args` get set from global flags for `runtime_config` fixture in unit tests

The `Compiler.compile` method accesses `self.config.args.which`. The `config`
is the `RuntimeConfig` the `Compiler` was instantiated with. Our `runtime_config`
fixture was being instatiated with an empty dict for the `args` property. Thus
a `which` property of the args wasn't being made avaiable, and if `compile` was run
a runtime error would occur. To solve this, we've begun instantiating the args from
the global flags via `get_flags()`. This works because we ensure the `set_test_flags`
fixture is run first which calls `set_from_args`.

* Create a `make_manifest` utility function for use in unit tests and fixture creation

* Refactor `Compiler` and `NodeSelector` tests in `test_selector.py` to use pytesting methodology

* Remove parsing tests that exist in `test_selector.py`

We had some tests in `test_selector.py::GraphTest` that didn't add
anything ontop of what was already being tested else where in the file
except the parsing of models. However, the tests in `test_parser.py::ModelParserTest`
cover everything being tested here (and then some). Thus these tests
in `test_selector.py::GraphTest` are unnecessary and can be deleted.

* Move `test__partial_parse` from `test_selector.py` to `test_manifest.py`

There was a test `test__partial_parse` in `test_selector.py` which tested
the functionality of `is_partial_parsable` of the `ManifestLoader`. This
doesn't really make sense to exist in `test_selector.py` where we are
testing selectors. We test the `ManifestLoader` class in `test_manifest.py`
which seemed like a more appropriate place for the test. Additionally we
renamed the test to `test_is_partial_parsable_by_version` to more accurately
describe what is being tested.

* Make `test_selector`'s manifest fixture name even more specific

* Add type hint to `expected_nodes` in `test_selector.py` tests

In the test `tests/unit/graph/test_selector.py::TestCompiler::test_two_models_simple_ref`
we have a variable `expected_nodes` that we are setting via a list comprehension.
At a glance it isn't immediately obvious what `expected_nodes` actually is. It's a
list, but a list of what? One suggestion was to explicitly write out the list of strings.
However, I worry about the brittleness of doing so. That might be the way we head long
term, but as a compromise for now, I've added a type hint the the variable definition.
2024-06-10 10:09:33 -07:00
Gerda Shank
4df120e40e Fix snapshot config to work in yaml files (#10275) 2024-06-07 17:22:05 -04:00
Chenyu Li
e53420c1d0 Update semantic interface requirement (#10276)
* Update semantic interface requirement

* Update setup.py
2024-06-07 13:27:46 -07:00
Nev Delap
88ccc8a447 Fire skipped events at debug level (#10244)
* Fire skipped events at debug level

Closes https://github.com/dbt-labs/dbt-core/issues/8774

* add changelog entry

* Update to work with 1.9.*.

* Add tests for --fail-fast not showing skip messages unless --debug.

* Update test that works by itself, but assumes to much to work in integration tests.

---------

Co-authored-by: Scott Gigante <scottgigante@users.noreply.github.com>
2024-06-06 16:47:35 -07:00
Gerda Shank
a98059967d Fix issues with inline nodes and selectors (#10264) 2024-06-06 16:18:07 -04:00
Matthew McKnight
b680c7ae95 [Feature] add generic config for generic tests (#10245)
* init push arbitrary configs for generic tests pr

* iterative work

* initial test design attempts

* test reformatting

* test rework, have basic structure for 3 of 4 passing, need to figure out how to best represent same key error, failing correctly though

* swap up test formats for new config dict and mixed varitey to run of dbt parse and inspecting the manifest

* modify tests to get passing, then modify the TestBuilder class work from earlier to be more dry

* add changelog

* modify code to match suggested changes around seperate methods and test id fix

* add column_name reference to init for deeper nested _render_values can use the input

* add type annotations

* feedback based on mike review
2024-06-05 10:37:37 -05:00
Chenyu Li
a677abd5e8 Move to test concrete class over abstract class (#10243) 2024-06-04 14:48:09 -07:00
Kshitij Aranke
8c850b58cb update dbt_utils version to 1.2.0 (#10260) 2024-06-04 22:24:41 +01:00
Quigley Malcolm
a34267f54b Create RuntimeConfig fixture (#10242)
* Create `runtime_config` fixture and necessary upstream fixtures

* Check for better scoped `ProjectContractError` in test_runtime tests

Previously in `test_unsupported_version_extra_config` and
`test_archive_not_allowed` we were checking for `DbtProjectError`. This
worked because `ProjectContractError` is a subclass of `DbtProjectError`.
However, if we check for `DbtProjectError` in these tests than, some tangential
failure which raises a `DbtProejctError` type error would go undetected. As
we plan on modifying these tests to be pytest in the coming commits, we want to
ensure that the tests are succeeding for the right reason.

* Convert `test_str` of `TestRuntimeConfig` to a pytest test using fixtures

* Convert `test_from_parts` of `TestRuntimeConfig` to a pytest test using fixtures

While converting `test_from_parts` I noticed the comment
>  TODO(jeb): Adapters must assert that quoting is populated?

This led me to beleive that `quoting` shouldn't be "fully" realized
in our project fixture unless we're saying that it's gone through
adapter instantiation. Thus I update the `quoting` on our project
fixture to be an empty dict. This change affected `test__str__` in
`test_project.py` which we thus needed to update accordingly.

* Convert runtime version specifier tests to pytest tests and move to test_project

We've done two things in this commit, which arguably _should_ have been done in
two commits. First we moved the version specifier tests from `test_runtime.py::TestRuntimeConfig`
to `test_project.py::TestGetRequiredVersion` this is because what is really being
tested is the `_get_required_version` method. Doing it via `RuntimeConfig.from_parts` method
made actually testing it a lot harder as it requires setting up more of the world and
running with a _full_ project config dict.

The second thing we did was convert it from the old unittest implementation to a pytest
implementation. This saves us from having to create most of the world as we were doing
previously in these tests.

Of note, I did not move the test `test_unsupported_version_range_bad_config`. This test
is a bit different from the rest of the version specifier tests. It was introduced in
[1eb5857811](1eb5857811)
of [#2726](https://github.com/dbt-labs/dbt-core/pull/2726) to resolve [#2638](https://github.com/dbt-labs/dbt-core/issues/2638).
The focus of #2726 was to ensure the version specifier checks were run _before_ the validation
of the `dbt_project.yml`. Thus what this test is actually testing for is order of
operations at parse time. As such, this is really more a _functional_ test than a
unit test. In the next commit we'll get this test moved (and renamed)

* Create a better test for checking that version checks come before project schema validation

* Convert `test_get_metadata` to pytest test

* Refactor `test_archive_not_allowed` to functional test

We do already have tests that ensure "extra" keys aren't allowed in
the dbt_project.yaml. This test is different because it's checking that
a specific key, `archive`, isn't allowed. We do this because at one point
in time `archive` _was_ an allowed key. Specifically, we stopped allowing
`archive` in dbt-core 0.15.0 via commit [f26948dd](f26948dde2).
Given that it's been 5 years and a major version, we could probably remove
this test, but let's keep it around unless we start supporting `archive` again.

* Convert `warn_for_unused_resource_config_paths` tests to use pytest
2024-05-31 13:47:28 -07:00
Doug Beatty
155482851a Button to open an issue for the docs.getdbt.com documentation repo (#10239) 2024-05-30 06:14:34 -06:00
Kshitij Aranke
81386a7a43 Move StatsItem, StatsDict, TableMetadata to dbt-common (#10238) 2024-05-30 02:22:41 +01:00
Emily Rockman
d8e38c1a1d add recording types (#10175)
* add new mode

* reflect dbt-common changes

* changelog

* rename var
2024-05-29 14:53:06 -05:00
Michelle Ark
3e37d77780 [Fix] Renaming or removing a contracted model raises a BreakingChange warning/error (#10221) 2024-05-28 15:48:21 -04:00
Michelle Ark
e0783c2922 Fix: prefer disabled project nodes to external node (#10223) 2024-05-28 11:37:33 -04:00
Michelle Ark
c2d4643f9d add --host flag to docs serve (#10228) 2024-05-28 11:11:56 -04:00
Michelle Ark
84456f50f6 Fix: Order-insensitive unit test equality assertion for expected/actual with multiple nulls (#10202) 2024-05-24 10:12:26 -04:00
Michelle Ark
fb10bb4aea Maximally parallelize dbt clone (#10129) 2024-05-23 11:06:04 -04:00
FishtownBuildBot
366d4ad04a Add most recent dbt-docs changes (#10217) 2024-05-22 15:41:57 -07:00
Michelle Ark
0c08d7a19a change port bind and add a unittest (#10208) 2024-05-22 10:00:54 -04:00
Chenyu Li
eb71ad9a89 Remove Print and use event system (#10131) 2024-05-21 15:12:00 -07:00
Chenyu Li
ad6120080a Reorganize tests to match their code location (#10191) 2024-05-21 14:50:51 -07:00
Chenyu Li
6813007e28 add saved query resource type (#10168)
* add saved query resource type

* nits
2024-05-21 13:57:30 -07:00
Quigley Malcolm
09243d1e5d Improved flags fixturing for for repository unit tests (#10190)
* Add fixtures for setting and resettign flags for unit tests

* Remove unnecessary `set_from_args` in non `unittest.TestCase` based unit tests

In the previous commit we added a pytest fixture which sets and tears down
the global flags arg via `set_from_args` for every pytest based unit test.
Previously we had added a `set_from_args` in tests or test files to reset
the global flags from if they were modified by a previous test. This is no
longer necessary because of the work done in the previous commit.

Note: We did not modify any tests that use the `unittest.TestCase` class
because they don't use pytest fixtures. Thus those tests need to continue
operating as they currently do until we shift them to pytest unit tests.

* Utilize the new `args_for_flags` fixture for setting of flags in `test_contracts_graph_parsed.py`

* Convert `test_compilation.py` from `TestCase` tests to pytest tests

We did this so in the next commit we can drop the unnecessary `set_from_args`
in the next commit. That will be it's own commit because converting these
tests is a restructuring that doing separately makes things easier to follow.
That is to say, all changes in this commit were just to convert the tests to
pytest, no other changes were made.

* Drop unnecessary `set_from_args` in `test_compilation.py`

* Add return types to all methods in `test_compilation.py`

* Reduce imports from `compilation` in `test_compilation.py`

* Update `test_logging.py` now that we don't need to worry about global flags

* Conditionally import `Generator` type for python 3.8

In python 3.9 `Generator` was moved to `collections.abc` and deprecated
in `typing`. We still support 3.8 and thus need to be conditionally
importing `Generator`. We should remove this in the future when we drop
support for 3.8.
2024-05-21 09:51:13 -07:00
Peter Webb
0d297c2537 Add more accurate RSS high water mark measurement for Linux (#10177)
* Add more accurate RSS high water mark measurement for Linux

* Add changelog entry.

* Checks to avoid exception based flow control, per review.

* Fix review nit.
2024-05-21 11:01:22 -04:00
Quigley Malcolm
341803d784 Standardize event catching during repository unit tests (#10153)
* Add unit test to assert `setup_config_logger` clears the event manager state

* Move `setup_event_logger` tests from `test_functions.py` to `test_logging.py`

* Move `EventCatcher` to `tests.utils` for use in unit and functional tests

* Update fixture mocking global event manager to instead clear it

Previously we had started _mocking_ the global event manager. We did this
because we though that meant anything we did to the global event manager,
including modifying it via things like `setup_event_logger`, would be
automatically cleaned up at the end of any test using the fixture because
the mock would go away. However, this understanding of fixtures and mocking
was incorrect, and the global event manager wouldn't be properly isolated/reset.
Thus we changed to fixture to instead cleanup the global event manager before
any test that uses it and by using `autouse=True` in the fixture definition
we made it so that every unit test uses the fixture.

Note this will no longer be viabled if we every multi-thread our unit testing as
the event manager isn't actually isolated, and thus two tests could both modify
the event manager at the same time.
2024-05-16 15:52:19 -07:00
Quigley Malcolm
32a7f82772 Repository unit tests for ManifestLoader.get_full_manifest (#10147)
* Add test for different `write_perf_info` values to `get_full_manifest`

* Add test for different `reset` values to `get_full_manifest`

* Abstract required mocks for `get_full_manifest` tests to reduce duplication

There are a set of required mocks that `get_full_manifest` unit tests need.
Instead of doing these mocks in each test, we've abstracted these mocks into
a reusable function. I did try to do this as a fixture, but for some reaosn
the mocks didn't actually propagate when I did that.

* Add test for different `PARTIAL_PARSE_FILE_DIFF` values to `get_full_manifest`

* Refactor mock fixtures in `test_manifest.py` to make them more widely available

* Convert `set_required_mocks` of `TestGetFullManifest` into a fixture

This wasn't working before, but it does now. Not sure why.
2024-05-15 12:02:37 -07:00
Doug Beatty
d21ff38ba1 Rename the "Explain It Like I'm 64" folder to "guides" (#10141) 2024-05-14 10:41:02 -06:00
Kshitij Aranke
2f7ef5f120 [Tidy First] Remove wheel and twine from dev-requirements.txt (#10140) 2024-05-14 17:31:02 +01:00
Kshitij Aranke
751139d8c1 Fix #9907: Add retry to tox to reduce flaky tests due to network failures (#10137) 2024-05-14 12:57:18 +01:00
Emily Rockman
03b621f390 remove logbook (#10119)
* remove logbook

* some cleanup, some bug fixes
2024-05-13 10:37:32 -05:00
Kshitij Aranke
4443a91c24 Fix #9970: Add security policy to project (#10136) 2024-05-13 14:17:40 +01:00
dave-connors-3
8fe7d652ab Add primary_key to manifest (#10096) 2024-05-10 15:14:20 -04:00
Jeremy Cohen
ecf9436c6e Update minimum req for dbt-common + dbt-adapters (#10123) 2024-05-10 15:22:35 +02:00
Kevin Neville
994a089b1f fix: #7586, Remove unused check_new method (#7756) 2024-05-09 12:30:35 -04:00
Michelle Ark
55aad328ea empty unit test csv fixture values default to null (#10117) 2024-05-09 09:49:18 -04:00
Jeremy Cohen
84cc54007e Check if ref'd resource is selected before favoring state (#10108)
* Add test case

* Check if ref'd resource is selected before favoring state

* Add changie
2024-05-08 20:01:37 +02:00
Michelle Ark
43d6c2f369 Unit test selection method (#10102) 2024-05-08 09:55:27 -04:00
Jeremy Cohen
fe9e39dab8 Fix #10098 by undoing conditional agate import in one place (#10103)
* Add test case

* Undo conditional agate import
2024-05-07 20:54:26 -04:00
Gerda Shank
760e4cea3a Enable serialization context (#10094)
* Update __post_serialize__ signatures

* Temporarily linke dbt-common and dbt-adapters branches

* Changie

* Move fields not in artifacts to resource __post_serialize__ methods

* remove defer_relation in snapshots

* Remove references to branch changes
2024-05-07 17:17:04 -04:00
Chenyu Li
e349e01829 Better error message for Private package definition (#10084)
* nits

* change error type
2024-05-07 13:02:20 -07:00
FishtownBuildBot
04ebe0f2a3 Cleanup main after cutting new 1.8.latest branch (#10082) 2024-05-07 08:11:27 -07:00
Jeremy Cohen
fb6dbc848e Update docs links + slightly tweak language for behavior change deprecations (#10077)
* Update deprecation warning language + links

* Update readmes

* Copyedits from self-review
2024-05-07 01:19:02 +02:00
Quigley Malcolm
65791e4d12 re-lint imports section of test_base_resource.py (#10095)
This was done by running `pre-commit run --all`. That this was needed
is a temporary glitch in how our `Tests and Code Checks` github action
works on PRs. Basically we added `isort` to the pre-commit hooks recently, and
this does additional linting/formatting on our imports.

People reasonably have branches which were started prior to `isort` being
part of the pre-commit hooks on main. Thus, unless those branches get caught
up to main, the github action on associated PRs won't run `isort` because
it doesn't exist on those branchs. Once everyone gets their local `main`
branch updated (I suspect this might take a few days) this problem will go
away.
2024-05-06 14:20:41 -07:00
Michelle Ark
3e8f2f1c27 test minor artifact changes for backward + forward compatability (#10066) 2024-05-06 11:30:14 -04:00
Quigley Malcolm
29b83598e3 [Tidy First] Use isort to order/format/de-dupe python imports (#10085)
* Add `isort` as a dev-req and pre-commit hook

The tool `isort` reorders imports to be in alphabetical order. I've
added it because our imports in most files are in random order. The lack
of order meant that:
- sometimes the same module would be imported from twice
- figuring out if a a module was already being imported from took
  longer

In the next commit I'll actually run isort to order everything. The best
part is that when developing, we don't have to put them in correct order.
Though you can if you want. However, `isort` will take care of re-ordering
things at commit time :)

* Improve isort functionality by setting initial `.isort.cfg`

Specifically we set two config values: `extend_skip_glob` and `known_first_party`.
The `extend_skip_glob` extends the default skipped paths. The defaults can be seen
here https://pycqa.github.io/isort/docs/configuration/options.html#skip. We are skipping
third party stubs because these are more so provided (I believe). We are skipping
`.github` and `scripts` as they feel out of scope and things we can be less strict with.

The `known_first_party` setting makes it so that these imports get grouped separately from
all other imports, which is useful visually of "this comes from us" vs "this comes from
someone/somewhere else".

* Add profile `black` to isort config

I was seeing some odd behavior where running pre-commit, adding the modified
files, and then running pre-commit again would result making more modifications
to some of the same files. This felt odd. You shouldn't have to run pre-commit
more multiple times for it to eventually come to a final "solution". I believe
the problem was because we are using the tool `black` to format things, but weren't
registering the black profile with `isort` this lead to some conflicting formatting
rules, and the two tools had to negotiate a few times before being both satisfied.
Registering the profile `black` with `isort` resolved this problem.

* Reorder, merge-duplicate, and format module imports using `isort`

This was done by running `pre-commit run --all`. I ran it separately from
the commit process itself because I wanted to run it against all files
instead of only changed files.

Of note, this not only reordered and formatted our imports. But we also
had 60 distinct duplicate module import paths across 50 files, which this
took care of. When I say "distinct duplicate module import paths" I mean
when `from x.y.z import` was imported more than once in a single file.
2024-05-03 09:28:11 -07:00
Chenyu Li
dc744f6e8f move partial parsing tests and add more examples (#10046)
* move partial parsing tests and add more examples

* nits

* nits
2024-05-02 09:57:40 -07:00
Emily Rockman
8b1f1d52c4 update readme install methods (#10081) 2024-05-02 10:14:02 -05:00
Emily Rockman
1bcef62e73 Recognize when loaded_at_field is explicitly set to null (#10065)
* add support for explicit nulls for loaded_at_field

* add test

* changelog

* add parsing for tests

* centralize logic a bit

* account for sources being None

* fix bug

* remove new field from SourceDefinition

* add validation for empty string, mroe tests
2024-05-02 09:55:33 -05:00
Jeremy Cohen
487a5321df Move deferral resolution from merge_from_artifact to RuntimeRefResolver (#9199)
* Move deferral from task to manifest loading + RefResolver

* dbt clone must specify --defer

* Fix deferral for unit test type deteection

* Add changelog

* Move merge_from_artifact from end of parsing back to task before_run to reduce scope of refactor

* PR review. DeferRelation conforms to RelationConfig protocol

* Add test case for #10017

* Update manifest v12 in test_previous_version_state

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-05-02 15:38:28 +02:00
Muhammad Jarir Kanji
f884eb4473 Change agate upper bound to v1.10 (#9948)
* Change agate upper bound to v1.10

* Add changelog.

* update lower pin

* for testing

* put back dev requirement

* move the lower pin back to 1.7

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-05-01 16:18:41 -05:00
FishtownBuildBot
4cb6d47bf7 Add most recent dbt-docs changes (#10072) 2024-05-01 20:24:08 +02:00
barton996
01f5dc8b85 Add current package selection syntax (#9270)
Co-authored-by: Jeremy Cohen <jtcohen6@gmail.com>
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2024-05-01 20:12:34 +02:00
Kshitij Aranke
2e3c6fe614 Fix #9672: Artifact Schema Check (#10069) 2024-05-01 17:13:18 +02:00
Jeremy Cohen
a36057d6e9 Consistent behavior change flag names + deprecation warnings (#10063)
* Rename flags

* Attempt refactor of flag require_resource_names_without_spaces

* Add deprecation warning for source_freshness_run_project_hooks

* Switch require_explicit_package_overrides_for_builtin_materializations default to True

* Add changelog

* fix core_types_pb2.py

* add playbook on introducing + maintaining behavoiur change flags

* be less canadian

* refactor: use hooks in FreshnessTask.get_hooks_by_type

* changelog entry for behaviour change

* Update docs link

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-05-01 13:26:23 +02:00
Quigley Malcolm
1a9fb612ed Add ability to silence warnings AND allow error and warn to be used for include and exclude (#10058)
* Refactor test class `EventCatcher` into utils to make accessible to other tests

* Raise minimum version of dbt_common to 1.0.2

We're going to start depending on `silence` existing as a attr of
`WarnErrorOptions`. The `silence` attr was only added in dbt_common
1.0.2, thus that is our new minimum.

* Add ability to silence warnings from `warn_error_options` CLI arguments

* Add `flush` to `EventCatcher` test util, and use in `test_warn_error_options`

* Add tests to `TestWarnErrorOptionsFromCLI` for `include` and `exclude`

* Test support for setting `silence` of `warn_error_options` in `dbt_project` flags

Support for `silence` was _automatically_ added when we upgraded to dbt_common 1.0.2.
This is because we build the project flags in a `.from_dict` style, which is cool. In
this case it was _automatically_ handled in `read_project_flags` in `project.py`. More
specifically here bcbde3ac42/core/dbt/config/project.py (L839)

* Add tests to `TestWarnErrorOptionsFromProject` for `include` and `exclude`

Typically we can't have multiple tests in the same `test class` if they're
utilizing/modifying file system fixtures. That is because the file system
fixtures are scoped to test classes, so they don't reset inbetween tests within
the same test class. This problem _was_ affectin these tests as they modify the
`dbt_project.yml` file which is set by a class based fixture. To get around this,
because I find it annoying to create multiple test classes when the tests really
should be grouped, I created a "function" scoped fixture to reset the `dbt_project.yml`.

* Update `warn_error_options` in CLI args to support `error` and `warn` options

Setting `error` is the same as setting `include`, but only one can be specified.
Setting `warn` is the same as setting `exclude`, but only one can be specified.

* Update `warn_error_options` in Project flags to support `error` and `warn` options

As part of this I refactored `exclusive_primary_alt_value_setting` into an upstream
location `/config/utils`. That is because importing it in `/config/project.py` from
`cli/option_types.py` caused some circular dependency issues.

* Use `DbtExclusivePropertyUseError` in `exclusive_primary_alt_value_setting` instead of `DbtConfigError`

Using `DbtConfigError` seemed reasonable. However in order to make sure the error
got raised in `read_project_flags` we had to mark it to be `DbtConfigError`s to be
re-raised. This had the uninteded consequence of reraising a smattering of errors
which were previously being swallowed. I'd argue that if those are errors we're
swallowing, the functions that raise those errors should be modified perhaps to
conditionally not raise them, but that's not the world we live in and is out of
scope for this branch of work. Thus instead we've created a error specific to
`WarnErrorOptions` issues, and now use, and catch for re-raising.


* Add unit tests for `exclusive_primary_alt_value_setting` method

I debated about parametrizing these tests, and it can be done. However,
I found that the resulting code ended up being about the same number of
lines and slightly less readable (in my opinion). Given the simplicity of
these tests, I think not parametrizing them is okay.
2024-04-30 16:30:06 -07:00
Quigley Malcolm
35062ca6af Reorganize more of the repository's unit tests (#10060) 2024-04-29 10:28:22 -05:00
Quigley Malcolm
4e1b44e353 Hardcode dbt version for project fixture in repository unit tests (#10059)
Letting the dbt version be dynamic in the project fixture previously was
causing some tests to break whenever the version of dbt actually got updated,
which isn't great. It'd be super annoying to have to always update tests
affected by this. To get around this we've gone and hard coded the dbt version
in the profile. The alternative was to interpolate the version during comparison
during the relevant tests, which felt less appealing.
2024-04-29 11:22:20 -04:00
Peter Webb
f6b2cb7fdc Paw/record final (#10045)
* Enable record/replay via environment variables.

* Add support for recording dbt's interactions, enabled by env var.

* Add changelog entry.
2024-04-26 10:48:16 -04:00
Mike Alfare
bcbde3ac42 pin macos test runners to macos-12 (#10031) 2024-04-25 08:29:52 -05:00
Quigley Malcolm
1e4bed0f1b Reorganize a number of our unit tests (#9972)
* Move `tests/unit/test_yaml_renderer.py` to `tests/unit/parser/test_schema_renderer.py`

* Move `tests/unit/test_unit_test_parser.py` to `tests/unit/parser/test_unit_tests.py`

* Convert `tests/unit/test_tracking.py` to use pytest fixtures

* Delete `tests/unit/test_sql_result.py` as it was moved to `dbt-adapters`

* Move `tests/unit/test_semantic_models.py` to `tests/unit/graph/test_nodes.py

* Group tests of `SemanticModel` in `test_nodes.py` into a `TestSemanticModel` class

* Move `tests/unit/test_selector_errors.py` to `tests/unit/config/test_selectors.py`
2024-04-24 16:37:14 -07:00
Chenyu Li
9a0b714fda [Bugfix][Selection] yaml selector do not obey default overwrite (#10009) 2024-04-24 15:43:18 -07:00
Michelle Ark
ddd6506bea add --empty flag to dbt build (#10027) 2024-04-24 18:30:01 -04:00
Emily Rockman
37b1fce205 Import SECRET_ENV_PREFIX from dbt-common (#10019)
* use the secret constant from dbt-common

* changelog

* add back the underscores to tests

* add missing underscore
2024-04-24 14:44:18 -05:00
Emily Rockman
2325759ba8 add script to override dev dependencies in tests (#10023) 2024-04-24 13:56:14 -05:00
Emily Rockman
29429ecf7b Use consistent secret scrubbing (#10006)
* replace secret placeholder with mask for consistency

* add test

* changelog

* move SECRET_PLACEHOLDER to avoid circular deps

* cleanup test
2024-04-24 13:52:37 -05:00
Quigley Malcolm
9a7be6de67 Update repository unit tests to have Project fixture and do additional Project testing (#10022)
* Add `Project` fixture for unit tests and test `Project` class methods

* Move `Project.__eq__` unit tests to new pytest class testing

* Move `Project.hashed_name` unit test to pytest testing class

* Rename some testing class in `test_project.py` to align with testing split

* Refactor `project` fixture to make accessible to other unit tests
2024-04-24 11:47:59 -07:00
Emily Rockman
0dc2a2f963 Add more package validation (#9986)
* validate packages are not empty strings

* add test

* changelog

* Update core/dbt/contracts/project.py

* fix test message
2024-04-23 20:17:47 -05:00
Michelle Ark
2d336553af Add flags.deprecate_package_materialization_builtin_override (#9956) 2024-04-23 15:54:18 -04:00
Kshitij Aranke
1014a6d490 Fix #9715: Simplify error message if test severity isn't 'warn' or 'error' (#10015) 2024-04-23 17:09:48 +02:00
Chenyu Li
27943a5ebc nits (#10012) 2024-04-23 07:50:45 -05:00
Emily Rockman
528b95cba8 pin proto-types to match proto pin (#9999) 2024-04-22 12:16:44 -05:00
Michelle Ark
0290cf7dd0 deprecate materialization overrides from imported packages (#9971) 2024-04-22 11:08:12 -04:00
Chenyu Li
5c8a4ab986 Change from unittest to pytest for manifestLoader (#9960) 2024-04-19 12:26:41 -07:00
Chenyu Li
8736508617 Reorganize some unittest (#9988) 2024-04-19 10:48:17 -07:00
Kshitij Aranke
4811ada35a Fix #9534: Add NodeRelation to SavedQuery Export (#9794) 2024-04-19 11:10:37 +01:00
FishtownBuildBot
afb2d61a08 [Automated] Merged prep-release/1.8.0b3_8741028171 into target main during release process 2024-04-18 10:19:45 -06:00
Github Build Bot
514647b29f Bumping version to 1.8.0b3 and generate changelog 2024-04-18 15:59:50 +00:00
Michelle Ark
4c587544b6 clear DBT_DEBUG after test_env_vars_secrets (#9978) 2024-04-18 11:54:22 -04:00
Michelle Ark
f5f9591d09 [Robust Testing] Move tests to tests/unit/context (#9966) 2024-04-18 10:44:28 -04:00
Emily Rockman
61727ab5b6 fix changelogs (#9975) 2024-04-18 10:35:24 -04:00
Emily Rockman
f87964ec1c updated unit test paths (#9963) 2024-04-18 09:12:00 -05:00
Emily Rockman
2edd5b3335 fix change kind (#9964) 2024-04-17 14:28:27 -05:00
Damian Owsianny
668fe78e2d Fix query comments test (#9861) 2024-04-17 12:00:48 -04:00
Michelle Ark
fe28d9e115 Revert "revert python version for docker images" (#9687) 2024-04-17 10:37:49 -04:00
Michelle Ark
5cb127999c add test for unit test that depends on ephemeral model (#9929) 2024-04-17 10:22:12 -04:00
Gerda Shank
86b349f812 Support using sql in unit testing fixtures (#9873) 2024-04-16 20:17:40 -04:00
Chenyu Li
a70024f745 Reorganize fixtures and implement a happy path test for semantic_manifest (#9930) 2024-04-16 16:36:05 -07:00
Niels Pardon
8b5884b527 Scrub secret vars (#9733)
- Scrub secret vars in RequiredVarNotFoundError
- Scrub secret vars in StateCheckVarsHash event
- Scrub secret vars in run results
2024-04-16 16:23:16 -07:00
Emily Rockman
4c1d0e92cd Fix nightly release & Docker drafts (#9954)
* add permission

* allow only docker release

* move new input to manual runs

* log input

* check failures/skipped

* pr nits
2024-04-16 10:12:21 -05:00
dependabot[bot]
6e7e55212b Bump black from 23.3.0 to 24.3.0 (#8074)
* Bump black from 23.3.0 to 23.7.0

Bumps [black](https://github.com/psf/black) from 23.3.0 to 23.7.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/23.3.0...23.7.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

* Update dev-requirements.txt

* Discard changes to .changes/unreleased/Dependencies-20230712-004015.yaml

* Add automated changelog yaml from template for bot PR

* Update .changes/unreleased/Dependencies-20240410-183321.yaml

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
Co-authored-by: Kshitij Aranke <kshitij@aranke.org>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-04-16 15:05:35 +01:00
Emily Rockman
11dbe679b9 stop bumping version in DockerFile (#9950) 2024-04-16 07:32:09 -05:00
Emily Rockman
c63ae89efb bump sqlparse to 0.5 (#9951)
* bump sqlparse

* changelog
2024-04-16 07:31:54 -05:00
Mike Alfare
ee74a60082 Simplify docker release process in the release pipeline (#9928)
* simplify dockerfile, eliminate references to adapter repos as they will be handled in those repos
* keep dbt-postgres target for historical releases of dbt-postgres
* update third party image to pip install conditionally
2024-04-15 17:26:01 -04:00
Michelle Ark
607646b627 Remove core imports from dbt.artifacts component (#9694) 2024-04-15 11:52:04 -07:00
Edgar Ramírez Mondragón
7e164e3ab7 Fix conflict with newer versions of Snowplow tracker (#9680)
Co-authored-by: Alik Kurdyukov <alik@kurdyukov.com>
2024-04-15 16:06:35 +01:00
Emily Rockman
7e72cace2b be less explicit (#9936) 2024-04-15 08:39:12 -05:00
Quigley Malcolm
c53d67d3b5 Migrate from custom _error_tag to dbt-common defined error_tag (#9927) 2024-04-12 14:19:52 -07:00
Michelle Ark
cb56f4fdc1 source freshness precomputes metadata-based freshness in batch, if possible (#9749) 2024-04-12 13:36:37 -07:00
Quigley Malcolm
f15e128d6c Begin warning people about spaces in model names (#9886)
* Add event type for deprecation of spaces in model names

* Begin emitting deprecation warning for spaces in model names

* Only warn on first model name with spaces unless `--debug` is specified

For projects with a lot of models that have spaces in their names, the
warning about this deprecation would be incredibly annoying. Now we instead
only log the first model name issue and then a count of how many models
have the issue, unless `--debug` is specified.

* Refactor `EventCatcher` so that the event to catch is setable

We want to be able to catch more than just `SpacesInModelNameDeprecation`
events, and in the next commit we will alter our tests to do so. Thus
instead of writing a new catcher for each event type, a slight modification
to the existing `EventCatcher` makes this much easier.

* Add project flag to control whether spaces are allowed in model names

* Log errors and raise exception when `allow_spaces_in_model_names` is `False`

* Use custom event for output invalid name counts instead of `Note` events

Using `Note` events was causing test flakiness when run in a multi
worker environment using `pytest -nauto`. This is because the event
manager is currently a global. So in a situation where test `A` starts
and test `tests_debug_when_spaces_in_name` starts shortly there after,
the event manager for both tests will have the callbacks set in
`tests_debug_when_spaces_in_name`. Then if something in test `A` fired
a `Note` event, this would affect the count of `Note` events that
`tests_debug_when_spaces_in_name` sees, causing assertion failures. By
creating a custom event, `TotalModelNamesWithSpacesDeprecation`, we limit
the possible flakiness to only tests that fire the custom event. Thus
we didn't _eliminate_ all possibility of flakiness, but realistically
only the tests in `test_check_for_spaces_in_model_names.py` can now
interfere with each other. Which still isn't great, but to fully
resolve the problem we need to work on how the event manager is
handled (preferably not globally).

* Always log total invalid model names if at least one

Previously we only logged out the count of how many invalid model names
there were if there was two or more invalid names (and not in debug mode).
However this message is important if there is even one invalid model
name and regardless of whether you are running debug mode. That is because
automated tools might be looking for the event type to track if anything
is wrong.

A related change in this commit is that we now only output the debug hint
if it wasn't run with debug mode. The idea being that if they are already
running it in debug mode, the hint could come accross as somewhat
patronizing.

* Reduce duplicate `if` logic in `check_for_spaces_in_model_names`

* Improve readability of logs related to problematic model names

We want people running dbt to be able to at a glance see warnings/errors
with running their project. In this case we are focused specifically on
errors/warnings in regards to model names containing spaces. Previously
we were only ever emitting the `warning_tag` in the message even if the
event itself was being emitted at an `ERROR` level. We now properly have
`[ERROR]` or `[WARNING]` in the message depending on the level. Unfortunately
we couldn't just look what level the event was being fired at, because that
information doesn't exist on the event itself.

Additionally, we're using events that base off of `DynamicEvents` which
unfortunately hard coded to `DEBUG`. Changing this would involve still
having a `level` property on the definition in `core_types.proto` and
then having `DynamicEvent`s look to `self.level` in the `level_tag`
method. Then we could change how firing events works based on the an
event's `level_tag` return value. This all sounds like a bit of tech
debt suited for PR, possibly multiple, and thus is not being done here.

* Alter `TotalModelNamesWithSpacesDeprecation` message to handle singular and plural

* Remove duplicate import in `test_graph.py` introduced from merging in main

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-04-12 13:25:28 -07:00
Michelle Ark
99d033ffec Disambiguate FreshnessConfigProblem error message (#9891) 2024-04-12 13:01:16 -07:00
Emily Rockman
6fee361183 update to wrk for all versions (#9916) 2024-04-12 13:30:02 -05:00
Michelle Ark
95581cc661 search for dbt_core source distribution (#9915) 2024-04-12 14:04:54 -04:00
Gerda Shank
3c4456ddbf [Tidy first] Fix three unit tests without set_args, fix mock in test_graph.py (#9897)
* Update 3 unit tests with set_args

* Fix test_graph.py test to not hang with pytest -s
2024-04-12 13:09:53 -04:00
Emily Rockman
b44c2e498d Fix changlogs, remove PR reference (#9887)
* stop referencing PRs

* convert PR to Issue in older yaml
2024-04-12 09:02:48 -05:00
Peter Webb
c86cec3256 Allow for customization of the environment in which test fixtures are initialized. (#9894) 2024-04-11 14:36:49 -04:00
Gerda Shank
a1f005789d [Tidy first] Task config type (#9874) 2024-04-10 09:30:53 -04:00
Quigley Malcolm
d03292e8b9 Delete empty files that have been floating around with no future plans (#9878)
* Delete empty `test_compiler.py` file

Over a year ago in [#7008](https://github.com/dbt-labs/dbt-core/pull/7008/files#diff-c10753a61a1d8f973ec3206206d72b3c5200e41673ab2c6b256f333103eadb8f)
the tests in `test_compiler.py` got moved into other testing files. Since
then this file has been sitting around empty. It is probably a reasonable
time to say goodbye to it.

* Delete empty `searcher.py` file

The file `searcher.py` was added, as an empty file, four years ago in
[#2312](https://github.com/dbt-labs/dbt-core/pull/2312/files#diff-c8e9e62cf63356f44fe1a2b0272b239d7a650c57911477ed4549b15ee3de16fa).
Since then it has never been touched or added to. I'm not sure of the
initial purpose of the file as it never contained anything and I have not
found any documentation in reference to it. It's safe to say, it can go
away.
2024-04-09 23:51:15 -07:00
Jaejun
ebacedd89d Fix configuration of turning test warnings into failures (#9347) 2024-04-09 18:19:37 -07:00
Reza J. Bavaghoush
fb41ce93d6 fix(core): relax pathspec upper bound version limitation (#9373)
* fix(core): relax pathspec upper bound version limitation

* add changelog entry PR #9373
2024-04-09 19:15:21 -06:00
Samuel Favarin
1e4e15c023 Better error message when trying to select a disabled model (#9863)
* feat: update log message

* chore: add change log

* Body for changelog entry

---------

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2024-04-09 07:23:12 -05:00
Quigley Malcolm
cf08b8411a Remove try/except logic for importing Empty from queue library (#9877)
Following [PEP8](https://peps.python.org/pep-0008/#package-and-module-names)
the Python 2 library `Queue` was renamed to `queue` in [Python 3](https://peps.python.org/pep-3108/#pep-8-violations-done).
Our try/except logic was to ensure the `Empty` class was imported without
error when running Python 2. Python 2 went EOL January 1st, 2020 and we
haven't supported Python 2 in a very long time. As such, it seems past time
to remove this relic.
2024-04-08 12:51:20 -07:00
Doug Beatty
e81f7fdbd5 Only create the packages-install-path / dbt_packages folder during dbt deps (#9810)
* Changelog entry

* The packages-install-path should not be created by `dbt list`

* Only create packages-install-path during `dbt deps`
2024-04-05 15:26:52 -06:00
niteshy
96f54264b4 Removing unwanted dev dependency (#9838)
* Removing unwanted dev dependency

* updating change log

* Remove duplicate dependency of protobuf in dev-requirements to resolve #9830

---------

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2024-04-05 11:19:39 -07:00
Gerda Shank
b945d177d3 [Tidy first] Add "Flags" to args parameters in tasks (#9856)
* Add "Flags" to args parameter in tasks

* Add comment
2024-04-05 13:38:55 -04:00
Chenyu Li
ebc22fa26c [BUG] Exclude password-like fields for considering reparse (#9844) 2024-04-04 14:34:31 -07:00
Andrew Sweet
a994ace2db Add fnMatch to group selectors (#9812) 2024-04-03 09:28:53 -07:00
FishtownBuildBot
f2a5ad0504 [Automated] Merged prep-release/1.8.0b2_8540873245 into target main during release process 2024-04-03 10:17:19 -05:00
Github Build Bot
fe33dcc3d6 Bumping version to 1.8.0b2 and generate changelog 2024-04-03 14:57:18 +00:00
Doug Beatty
c95b1ea5e6 Expect that the args variable is un-modified by dbt.invoke(args) (#9809)
* Expect that the `args` variable is un-modified by `dbt.invoke(args)`

* Make `args` variable un-modified by `dbt.invoke(args)`

* Changelog entry

* Expect that the `args` variable is un-modified by `make_dbt_context`

* Make the `args` variable is un-modified by `make_dbt_context`

* Make a copy of `args` passed to `make_dbt_context`

* Revert "Make a copy of `args` passed to `make_dbt_context`"

This reverts commit 79227b4d34.
2024-04-02 16:48:22 -06:00
Emily Rockman
0d87d314ac automate docker release (#9833)
* add docker release

* determine core vs postgres vs both

* update workflow name

* update comments

* fix workflow name:

* add permissions

* fix matrix generation, add more info to names

* remove defaults
2024-04-02 14:31:03 -05:00
Gerda Shank
71f3519611 Tidy first: rename node, realnode to unique_id, node in selector_methods.py (#9837) 2024-03-29 14:38:39 -04:00
Mike Alfare
02d7727365 Fix Docker release process for dbt-postgres (#9828)
* revert to the 1.7 approach, 1.8 will be handled in the new repo
2024-03-28 13:18:59 -04:00
Kshitij Aranke
f683e36468 Fix #9608: Unit test path outputs (#9793) 2024-03-27 15:58:16 +00:00
Gerda Shank
cfaacc6e49 Include node_info in various Result events (#9820) 2024-03-27 11:41:47 -04:00
Quigley Malcolm
a029661e23 Fix assorted source freshness edgecases so check is run or actionable information (#9825)
* Ensure BaseRunner handles nodes without `build_path`

Some nodes, like SourceDefinition nodes, don't have a `build_path` property.
This is problematic because we take in nodes with no type checking, and
assume they have properties sometimes, like `build_path`. This was just
the case in BaseRunner's `_handle_generic_exception` and
`_handle_interal_exception` methods. Thus to stop dbt from crashing when
trying to handle an exception related to a node without a `build_path`,
we added an private method to the BaseRunner class for safely trying
to get `build_path`.

* Use keyword arguments when instantiating `Note` events in freshness.py

Previously we were passing arguments during the `Note` event instantiations
in freshness.py as positional arguments. This would cause not the desired
`Note` event to be emitted, but instead get the message
```
[Note] Don't use positional arguments when constructing logging events
```
which was our fault, not the users'. Additionally, we were passing the
level for the event in the `Note` instantiation when we needed to be
passing it to the `fire_event` method.

* Raise error when `loaded_at_field` is `None` and metadata check isn't possible

Previously if a source freshness check didn't have a `loaded_at_field` and
metadata source freshness wasn't supported by the adapter, then we'd log
a warning message and let the source freshness check continue. This was problematic
because the source freshness check couldn't actually continue and the process
would raise an error in the form
```
type object argument after ** must be a mapping, not NoneType
```
because the `freshness` variable was never getting set. This error wasn't particularly
helpful for any person running into it. So instead of letting that error
happen we now deliberately raise an error with helpful information.

* Add test which ensures bad source freshness checks raise appropriate error

This test directly tests that when a source freshness check doesn't have a
`loaded_at_field` and the adapter in use doesn't support metadata checks,
then the appropriate error message gets raised. That is, it directly tests
the change made in a162d53a8. This test indirectly tests the changes in both
7ec2f82a9 and 7b0ff3198 as the appropriate error can only be raised because
we've fixed other upstream issues via those commits.

* Add changelog entry for source freshness edgecase fixes
2024-03-27 08:41:17 -07:00
Kshitij Aranke
80b2a47d60 Fix info message for TestsConfigDeprecation (#9823) 2024-03-27 14:47:57 +00:00
Andrew Sweet
9af5ec6069 Remove erroneously added wildcard method name (#9642)
* Remove erronously added `wildcard` method name

* Remove unused key
2024-03-26 12:25:33 -04:00
Emily Rockman
e46eae1f0e fix team name (#9805)
* fix team name

* use correct trigger

* trickle down permissions
2024-03-25 18:28:54 -05:00
Doug Beatty
c07186855f Update pytest examples for contributors (#9800) 2024-03-23 07:16:21 -06:00
Emily Rockman
3e7778c380 use issue context (#9807)
* use issue context

* more workding cleanup
2024-03-22 15:25:00 -05:00
Emily Rockman
68970d09fa update triggers to use issues for opening docs issues (#9803)
* update triggers to use issues

* Apply suggestions from code review

Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>

---------

Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>
2024-03-22 14:03:34 -05:00
Courtney Holcomb
8c8c6284fb Allow metrics in semantic layer filters (#9773)
* Tests for metrics in filters

* Bump DSI version

* Update test

* Changelog
2024-03-22 11:49:47 -07:00
Emily Rockman
b435e26aa4 ensure the upload name is unique (#9802) 2024-03-22 11:39:58 -05:00
Emily Rockman
58f9af7d58 Automate labeling PRs as community sourced (#9797)
* add calling workflow

* make quotes consistant
2024-03-22 11:18:36 -05:00
barton996
c6c0c79216 Add --target and --profile to global config (#9081)
* Add @p.profile and @p.target to the list of "global" CLI flags

* Add env vars (DBT_PROFILE, DBT_TARGET) to the params

* Add unit test

* Simplify unit test

* changie

* Update .changes/unreleased/Features-20231115-092005.yaml

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

* Fix incorrect envvar names

* Realign environment variable names

* Remove from specific subcommands

* Add test_global_flags_not_on_subcommands

* Remove one unnecessary test case

* Remove other unnecessary test case

---------

Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2024-03-21 16:25:17 -04:00
FishtownBuildBot
461e8e5323 Add new index.html and changelog yaml files from dbt-docs (#9735) 2024-03-21 10:59:30 -04:00
dependabot[bot]
0fa9690e38 Bump codecov/codecov-action from 3 to 4 (#9659)
* Bump codecov/codecov-action from 3 to 4

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-03-21 08:29:44 -05:00
Gerda Shank
cc42ec39e6 Enable use of env vars for --resource-types and --exclude-resource-types (#9779) 2024-03-20 18:56:33 -04:00
Quigley Malcolm
952cca8c58 Move protobuf dep to a more applicable section of setup.py (#9786)
Our `protobuf` dep was in the section of `setup.py` which we delineate
as expecting all future versions of it to be compatible. However, this
is no longer actually the case, and in e4fe839e45
we restricted it to major vesion 4.
2024-03-20 14:11:42 -07:00
dependabot[bot]
0c8a8de7cd Bump actions/upload-artifact from 3 to 4 (#9470)
* Bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-03-20 15:55:48 -05:00
Gerda Shank
c52a015f36 Fix retry of a command with defer (#9772)
* Make defer_state default None

* Unit test

* Fix error message

* Add retry to defer tests
2024-03-20 13:49:09 -04:00
Kshitij Aranke
c5eb6d70b4 Fix #9593: Validation of unit test parsing for incremental models (#9769) 2024-03-20 15:53:11 +00:00
Kshitij Aranke
2c1926cee9 Fix #9511: Handle exceptions for failing on-run-* hooks in source freshness (#9763) 2024-03-18 23:34:54 +00:00
Daniel Reeves
29395ac617 Make dbt CLI cold start load up to 8% faster with lazy loading of task modules and agate (#9744) 2024-03-18 17:29:41 -04:00
Jaejun
58344f4d25 Fix package-lock file's bad indentation (#9341)
* modified lock file's format

* changie

* modified integration test
2024-03-18 16:44:49 -04:00
Michelle Ark
65b366bca9 merge source meta and table meta on SourceDefinition.meta (#9723) 2024-03-15 16:28:31 -04:00
Michelle Ark
c501d71645 Unit Testing: Support overriding macros in packages (#9626) 2024-03-15 15:36:41 -04:00
Gerda Shank
d65bae5f05 Provide ability to exclude resource_types, instead of listing everything not excluded (#9756) 2024-03-13 16:17:47 -04:00
Michelle Ark
c48aaa03de fix source selection during catalog generation of over 100 relations (#9758)
* fix source selection during catalog generation of over 100 relations

* changelog entry

* restore dev-requirements.txt
2024-03-13 13:29:22 -04:00
Mario Loaiciga
7b8ae21c36 [#9570] Fix fixtures in fixtures/subfolders throwing parsing error (#9714)
* [#9570] Fix fixtures in fixtures/subfolders throwing parsing error

* Fast-forward imports to match upstream

* Re-introduce doc strings on traceback info handling

* [#9570] Changelog update for fix of fixtures in fixtures/subfolders throwing parsing error

* [#9570] Improve testability and coverage for partial parsing

* Transform skip_parsing (private variable of ManifestLoader.load()) into instance-attribute of ManifestLoader(), with default value False
  (to enable splitting of ManifestLoader.load())

* Split ManifestLoader.load(), to extract operation of PartialParsing into new method called ManifestLoader.safe_update_project_parser_files_partially()
  (to simplify both cognitive complexity in the codebase and mocking in unittestest)

* Add "ignore" type-comments in new ManifestLoader.safe_update_project_parser_files_partially()
  (to silence mypy warnings regarding instance-attributes which can be initialized as None or as something else, e.g. self.saved_manifest)[1]

[1] Although I wanted avoid "ignore" type-comments, it seems like addressing these mypy warnings in a stricter sense requires technical alignment and broader code changes.
	For example, might need to initialize self.saved_manifest as Manifest, instead of Optional[Manifest], so that PartialParsing gets inputs with type it currently expects.
	... perhaps too far beyond the scope of this fix?
2024-03-13 09:51:13 -04:00
Michelle Ark
d9c36c3a57 Update codeowners post adapters-decoupling (#9688) 2024-03-12 18:14:02 -04:00
Courtney Holcomb
bfb68b2619 Enable list filters for input metrics & measures (#9709) 2024-03-12 15:08:05 -04:00
Gerda Shank
a0abc58130 Do not add duplicate input_measures when parsing metrics (#9677)
* Check for equality with existing input_measures when adding input_measures

* Changie

* Add type annotation

* Move add_input_measure to metric from type_params
2024-03-12 10:02:43 -04:00
Quigley Malcolm
8a395e928d Fix listing saved queries (#9736)
* Add tests to check that saved queries show in `dbt list`

* Update `list` task to support saved queries

This is built off of @jtcohen6 work in d6e7cda on jerco/fix-9532.
I didn't directly cherry pick because there was more work to do as
well as merge conflicts. That is to say @jtcohen6 should be credited
with some of the work.

* Update error message when iterating over nodes during list command errors

This was originally suggested by @jtcohen6 in d6e7cda of jerco/fix-9532.
This commit just makes sure the change gets included because I didn't
cherry-pick that commit into this work.
2024-03-11 09:14:34 -07:00
Kshitij Aranke
7072a53770 Fix #9117: Bump version of dbt-semantic-interfaces (#9737) 2024-03-07 17:29:57 -05:00
Quigley Malcolm
deedeeb9ce Stop trying to parse deleted schema files (#9722)
* Add test around deleting a YAML file containing semantic models and metrics

It was raised in https://github.com/dbt-labs/dbt-core/issues/8860 that an
error is being raised during partial parsing when files containing
metrics/semantic models are deleted. In further testing it looks like this
error specifically happens when a file containing both semantic models and
metrics is deleted. If the deleted file contains just semantic models or
metrics there seems to be no issue. The next commit should contain the fix.

* Skip deleted schema files when scheduling files during partial parsing

Waaaay back (in 7563b99) deleted schema files started being separated out
from deleted non-schema files. However ever since, when it came to scheduling
files for reparsing, we've only done so for deleted non-schema files. We even
missed this when we refactored the scheduling code in b37e5b5. This change
updates `_schedule_for_parsing` which is used by `schedule_nodes_for_parsing`
to begin skipping deleted schema files in addition to deleted non schema files.

* Update `add_to_pp_files` to ignore `deleted_schema_files`

As noted in the previous commit, we started separating out deleted
schema files from deleted non-schema files a looong time ago. However,
this whole time we've been adding `deleted_schema_files` to the list
of files to be parsed. This change corrects for that.

* Add changie doc for partial parsing KeyError fix
2024-03-07 09:30:01 -05:00
Peter Webb
6fd0a94729 Handle exceptions during node execution more elegantly. (#9585)
* Handle exceptions during node execution more elegantly.

* Add changelog entry.

* Fix import

* Add task documentation.

* Change event type for noting thread exceptions.
2024-03-01 15:52:05 -05:00
Quigley Malcolm
e4fe839e45 Restrict protobuf to 4.* versions (#9630)
Protobuf v5 has breaking changes. Here we are limiting the protobuf
dependency to one major version, 4, so that we don't have to patch
over handling 2 different major versions of protobuf.
2024-02-29 09:19:23 -08:00
Emily Rockman
ce10240f5b Throw ParsingError for invalid PK definition on constraints (#9700)
* audit pks on constraints

* pr feedback
2024-02-29 09:42:23 -06:00
Emily Rockman
f48a927b86 swap var to make mypy happy (#9704) 2024-02-29 09:22:10 -06:00
FishtownBuildBot
fa993f3ea5 [Automated] Merged prep-release/1.8.0b1_8088330500 into target main during release process 2024-02-28 15:31:14 -08:00
Github Build Bot
ef1cb97755 Bumping version to 1.8.0b1 and generate changelog 2024-02-28 23:12:49 +00:00
Mike Alfare
fc431010ef allow for dbt-adapters 1.0.0b1 (#9691) 2024-02-27 18:46:33 -05:00
Michelle Ark
0d723f180a bump dbt-common in setup.py (#9690) 2024-02-27 15:37:31 -05:00
Michelle Ark
9d232398ee Convert from WritableManifest -> Manifest to represent deferred manifest internally (#9544) 2024-02-27 15:09:52 -05:00
Jeremy Cohen
865b09b2f0 Clearer no-op logging in stubbed SavedQueryRunner (#9605)
* Clearer no-op logging in stubbed SavedQueryRunner

* Add changelog entry

* Fix unit test

* More logging touchups

* Fix failing test

* Rename flag + refactor per #9629

* Fix failing test

* regenerate core_proto_types with libprotoc 25.3

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-02-27 08:19:09 -08:00
Michelle Ark
7329143ffb move UnitTestDefinition, implement missing resource_class methods (#9651) 2024-02-26 16:10:52 -05:00
Thomas Lento
d50aebb117 Update dbt-semantic-interfaces dependency to compatible range (#9671)
A recent update to the version ranges for our internally
maintained support packages quite reasonably expanded the
allowed versions for dbt-semantic-interfaces to all minor versions
after 0.5.0, under the assumption that subsequent releases will
generally be backwards-compatible.

Unfortunately, dbt-semantic-interfaces is not yet in that state.
So we update the version range accordingly, and include some
comments around version range expectations for dependencies
listed in this section of dbt-core's package configuration.
2024-02-26 13:07:51 -08:00
Kshitij Aranke
b337e0b726 Fix #9007: Make dbt-core compatible with Python 3.12 (#9612) 2024-02-26 14:27:47 -06:00
Peter Webb
4b6c57cede Paw/restrict to protobuf 4 (#9614)
* Restrict protobuf to version 4.

* Restrict protobuf to major version 4.

---------

Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-02-26 12:08:22 -08:00
aliceliu
2b23a038d4 Add method to infer primary key of model (#9650) 2024-02-25 23:29:43 -05:00
Emily Rockman
d1ebf9d12a remove ~= from dependency definitions (#9640)
* remove ~= from dependency definitions

* try lower bounds of alpha version

* Apply suggestions from code review

* Apply suggestions from code review
2024-02-23 13:35:52 -06:00
Mike Alfare
12e40e2581 Get the code-quality check working again (#9621)
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
Co-authored-by: Kshitij Aranke <kshitij@aranke.org>
2024-02-23 17:52:52 +00:00
Kshitij Aranke
d1e400eed2 Fix #8948: Add target-path to retry (#9646) 2024-02-23 17:28:17 +00:00
Quigley Malcolm
7ea4670832 Upgrade Jinja2 dependency version specification to address CVE-2024-22195 (#9638)
CVE-2024-22195 identified an issue in Jinja2 versions <= 3.1.2. As such
we've gone and changed our dependency requirement specification to be
3.1.3 or greater (but less than 4).

Note: Preivously we were using the `~=` version specifier. However due
to some issues with the `~=` we've moved to using `>=` in combination
with `<`. This gives us the same range that `~=` gave us, but avoids
a pip resolution issue when multiple packages in an environment use `~=`
for the same dependency.
2024-02-23 09:13:51 -08:00
dependabot[bot]
869ba181c7 Bump tibdex/backport from 2.0.3 to 2.0.4 (#8779)
* Bump tibdex/backport from 2.0.3 to 2.0.4

Bumps [tibdex/backport](https://github.com/tibdex/backport) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/tibdex/backport/releases)
- [Commits](https://github.com/tibdex/backport/compare/v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: tibdex/backport
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

* change doesn't require changelog

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-02-23 10:26:45 -06:00
dependabot[bot]
f36c4e7275 Bump freezegun from 0.3.12 to 1.3.0 (#9197)
* Bump freezegun from 0.3.12 to 1.3.0

Bumps [freezegun](https://github.com/spulec/freezegun) from 0.3.12 to 1.3.0.
- [Release notes](https://github.com/spulec/freezegun/releases)
- [Changelog](https://github.com/spulec/freezegun/blob/master/CHANGELOG)
- [Commits](https://github.com/spulec/freezegun/compare/0.3.12...1.3.0)

---
updated-dependencies:
- dependency-name: freezegun
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

* accept all minor 4 patches of freezegun

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-02-23 10:20:58 -06:00
dependabot[bot]
7f9874d260 Bump peter-evans/create-pull-request from 5 to 6 (#9552)
* Bump peter-evans/create-pull-request from 5 to 6

Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5 to 6.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v5...v6)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-02-23 09:56:35 -06:00
Emily Rockman
9a32716374 flags & tracking from dbt/artifacts (#9628)
* removing refs

* fix tests

* changelog
2024-02-23 09:14:49 -06:00
Quigley Malcolm
9bc80d52df Fix Check Artifact Changes Action (#9635)
* Remove extraneous `/` in `schema-check.yml`

We have hypothesis that the extra `/` in `schema-check` is causing
issues we're seeing currently in the artifact check failing. It may
not be the final solution, but we should fix it anyway.

* Move `artifact_minor_upgrade` label check to job level of `Check Artifact Changes`

Previously the checking for `artifact_minor_upgrade` was happening in each job
step of `Check Artifact Changes`. By moving it up to the job level instead of
in the job steps we make it so the check for the label only happens once and
it simplifies the job steps.

* Update `Check Artifact Changes` to use `dorny/paths-filter`

Previously we were using `git diff` to check if any files had changed
in `core/dbt/artifacts`. However, our `git diff` usage was including any
changes that happened on `main` which the PR branch did not have. This
commit switches the check from using `git diff` to `dorny/paths-filter`,
which is what we use for checking for changelog existence as well. The
`dorny/paths-fitler` includes logic for excluding changes that are on main
but not the PR branch (which is what want to happen).
2024-02-23 09:01:01 -06:00
Gerda Shank
83e51618d0 Do not allow hook node_info to persist past hook run (#9631)
* Use log_contextvars context manager in run_hooks

* Changie

* Add test

* Bump version of dbt-common
2024-02-23 09:00:35 -05:00
Gerda Shank
7df747ae04 Move manifest nodes to dbt/artifacts (#9538) 2024-02-21 11:16:06 -05:00
Courtney Holcomb
20f904951f Fix filter parsing bug (#9508)
* Use Union syntax that works for dataclasses

* Changelog

* Use simpler syntax

* Add comments explaining this for future devs

* Write tests
2024-02-20 11:37:40 -08:00
Emily Rockman
5198031d5b add test for unit tests with a snapshot as a dependency (#9592)
* add test for unit tests with a snapshot as a dependency

* account for unknown ordering
2024-02-20 11:56:26 -06:00
Emily Rockman
1ec5e22e2b remove uses of Repalceable class (#9589) 2024-02-16 14:33:08 -06:00
Emily Rockman
c7522d27ad add cache to SavedQueryConfig (#9588)
* add cache to saved query config

* fix flake issues

* fix typos
2024-02-16 14:31:05 -06:00
Emily Rockman
6965eca079 support meta at config level for metric nodes (#9580) 2024-02-16 09:27:52 -06:00
Quigley Malcolm
8a1b9276f9 Move SourceDefinition to dbt/artifacts (#9543)
* Move `ColumnInfo` to dbt/artifacts

* Move `Quoting` resource to dbt/artifacts

* Move `TimePeriod` to `types.py` in dbt/artifacts

* Move `Time` class to `components`

We need to move the data parts of the `Time` definition to dbt/artifacts.
That is not what we're doing in this commit. In this commit we're simply
moving the functional `Time` definition upstream of `unparsed` and `nodes`.
This does two things
  - Mirrors the import path that the resource `time` definition will have in dbt/artifacts
  - Reduces the chance of ciricular import problems between `unparsed` and `nodes`

* Move data part of `Time` definition to dbt/artifacts

* Move `FreshnessThreshold` class to components module

We need to move the data parts of the `FreshnessThreshold` definition to dbt/artifacts.
That is not what we're doing in this commit. In this commit we're simply
moving the functional `FreshnessThreshold` definition upstream of `unparsed` and `nodes`.
This does two things
  - Mirrors the import path that the resource `FreshnessThreshold` definition will have in dbt/artifacts
  - Reduces the chance of ciricular import problems between `unparsed` and `nodes`

* Move data part of `FreshnessThreshold` to dbt/artifacts

Note: We had to override some of the attrs of the `FreshnessThreshold`
resource because the resource version only has access to the resource
version of `Time`. The overrides in the functional definition of
`FreshnessThreshold` make it so the attrs use the functional version
of `Time`.

* Move `ExternalTable` and `ExternalPartition` to `source_definition` module in dbt/artifacts

* Move `SourceConfig` to `source_definition` module in dbt/artifacts

* Move `HasRelationMetadata` to core `components` module

This is a precursor to splitting `HasRelationMetadata` into it's
data and functional parts.

* Move data portion of `HasRelationMetadata` to dbt/artifacts

* Move `SourceDefinitionMandatory` to dbt/artifacts

* Move the data parts of `SourceDefinition` to dbt/artifacts

Something interesting here is that we had to override the `freshness`
property. We had to do this because if we didn't we wouldn't get the
functional parts of `FreshnessThreshold`, we'd only get the data parts.

Also of note, the `SourceDefintion` has a lot of `@property` methods that
on other classes would be actual attribute properties of the node. There is
an argument to be made that these should be moved as well, but thats perhaps
a separate discussion.

Finally, we have not (yet) moved `NodeInfoMixin`. It is an open discussion
whether we do or not. It seems primarily functional, as a means to update the
source freshness information. As the artifacts primarily deal with the shape
of the data, not how it should be set, it seems for now that `NodeInfoMixin`
should stay in core / not move to artifacts. This thinking may change though.

* Refactor `from_resource` to no longer use generics

In the next commit we're gonna add a `to_resource` method. As we don't
want to have to pass a resource into `to_resource`, the class itself
needs to expose what resource class should be built. Thus a type annotation
is no longer enough. To solve this we've added a class method to BaseNode
which returns the associated resource class. The method on BaseNode will
raise a NotImplementedError unless the the inheriting class has overridden
the `resouce_class` method to return the a resource class.

You may be thinking "Why not a class property"? And that is absolutely a
valid question. We used to be able to chain `@classmethod` with
`@property` to create a class property. However, this was deprecated in
python 3.11 and removed in 3.13 (details on why this happened can be found
[here](https://github.com/python/cpython/issues/89519)). There is an
[alternate way to setup a class property](https://github.com/python/cpython/issues/89519#issuecomment-1397534245),
however this seems a bit convoluted if a class method easily gets the job
done. The draw back is that we must do `.resource_class()` instead of
`.resource_class` and on classes implementing `BaseNode` we have to
override it with a method instead of a property specification.

Additionally, making it a class _instance_ property won't work because
we don't want to require an _instance_ of the class to get the
`resource_class` as we might not have an instance at our dispossal.

* Add `to_resource` method to `BaseNode`

Nodes have extra attributes. We don't want these extra attributes to
get serialized. Thus we're converting back to resources prior to
serialization. There could be a CPU hit here as we're now dictifying
and undictifying right before serialization. We can do some complicated
and non-straight-forward things to get around this. However, we want
to see how big of a perforance hit we actually have before going that
route.

* Drop `__post_serialize__` from `SourceDefinition` node class

The method `__post_serialize__` on the `SourceDefinition` was used for
ensuring the property `_event_status` didn't make it to the serialized
version of the node. Now that resource definition of `SourceDefinition`
handles serialization/deserialization, we can drop `__post_serialize__`
as it is no longer needed.

* Merge functional parts of `components` into their resource counter parts

We discussed this on the PR. It seems like a minimal lift, and minimal to
support. Doing so also has the benefit of reducing a bunch of the overriding
we were previously doing.

* Fixup:: Rename variable `name` to `node_id` in `_map_nodes_to_map_resources`

Naming is hard. That is all.

* Fixup: Ensure conversion of groups to resources for `WritableManifest`
2024-02-15 11:31:22 -06:00
Gerda Shank
2411f93240 Store node_info in GenericExceptionOnRun logging event (#9559) 2024-02-13 13:53:57 -05:00
Gerda Shank
5841d52792 Set query headers when manifest is passed in to dbtRunner (#9556) 2024-02-13 11:58:42 -05:00
Kshitij Aranke
03a4d118f3 Fix #9385: Add a workflow to check if artifacts have changed (#9553) 2024-02-13 14:57:17 +00:00
Chenyu Li
a1f6451090 Anther Fix for Semantic model same content (#9561) 2024-02-12 16:01:26 -08:00
Michelle Ark
c12f6fbf4d Fix: SemanticModel.same_model compares model attribute (#9549) 2024-02-09 23:38:15 -05:00
dependabot[bot]
f732b76dc3 Bump actions/cache from 3 to 4 (#9471)
* Bump actions/cache from 3 to 4

Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Quigley Malcolm <quigley.malcolm@dbtlabs.com>
2024-02-09 13:00:58 -08:00
Mirna Wong
edc60034a5 Update README.md (#9258)
this pr provides additional command line options (cloud cli) for dbt development, as well as clarifies 'dbt core' under the 'get started' header. 

cc @greg-mckeon
2024-02-09 13:00:32 -08:00
dependabot[bot]
63f40543ab Bump ddtrace from 2.1.7 to 2.3.0 (#9132)
* Bump ddtrace from 2.1.7 to 2.3.0

Bumps [ddtrace](https://github.com/DataDog/dd-trace-py) from 2.1.7 to 2.3.0.
- [Release notes](https://github.com/DataDog/dd-trace-py/releases)
- [Changelog](https://github.com/DataDog/dd-trace-py/blob/2.x/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-py/compare/v2.1.7...v2.3.0)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-02-09 15:36:01 -05:00
Chenyu Li
6f603f6006 still register adapter when manifest is provided (#9440) 2024-02-08 16:46:11 -08:00
Michelle Ark
581d8563cc initial readme for dbt/artifacts (#9514) 2024-02-08 11:12:21 -05:00
Gerda Shank
2b6e2e18df Preserve model constraints when versioning models (#9539) 2024-02-08 10:17:26 -05:00
Emily Rockman
1220fdfdd6 remove unnecesary fire_event_if_test (#9522)
* remove unnecesary fire_event_if_test

* modify tests

* remove unused import
2024-02-07 11:08:27 -06:00
Mike Alfare
07726b0047 Update artifacts left over from migrating dbt-postgres, dbt-common, and dbt-tests-adapter (#9527)
* update docker file to remove &subdirectory=plugins/postgres from git path
* remove extra proto file generation scripts which are no longer necessary in this repo
2024-02-07 10:58:18 -05:00
Peter Webb
e33b06badf Initialize invocation context before test fixture creation. (#9529) 2024-02-07 09:46:13 -05:00
colin-rogers-dbt
15dcb9a19d Remove dbt-postgres and dbt-tests-adapter from dbt-core (#9492)
* delete dbt-tests-adapter and dbt-postgres from dbt-core

* update non-code files to reflect change

* add changie

* update build-dist.sh

* update tox.ini

* fix build-dist.sh

* move adapter tests into /functional dir

* remove adapter unit tests

* update code comments and README.md
2024-02-05 12:28:57 -08:00
Gerda Shank
7885e874c6 Enable using the list command on unit tests (#9480) 2024-02-05 10:30:34 -05:00
Quigley Malcolm
93f1bd5df6 Begin using Mergeable supplied by dbt-common (#9509)
* Begin using `Mergeable` supplied by `dbt-common`

We're currently in the process of moving the "data resource" portion on nodes
to `dbt/artifacts`. Some of those artifacts depend on `Mergeable` which has
been defined on core. In order to move the data resources to `dbt/artifacts`,
we thus need to move `Mergeable` upstream of core. We moved `Mergeable` to
[dbt-common](https://github.com/dbt-labs/dbt-common) in
https://github.com/dbt-labs/dbt-common/pull/59, and released this change in
[dbt-common 0.1.3](https://pypi.org/project/dbt-common/0.1.3/). As such as, in
order to unblock some of the `dbt/artifacts` migration work, we first need to
update references to `Mergeable` in core to use the `dbt-common` definition.

NOTE: We include changing over to `Replaceable` from `dbt-common` in this
commit. This is because there wasn't a clean way to do it. If I moved the imports
of `Replaceable` on in the files where we updated `Mergeable` then we would
have left `Replaceable` in an inbetween state. If we had moved all instances
of `Replaceable`, it'd be out of scope for the change. As such, it makes more
sense to do that as a separate changeset.

* Remove definition of `Mergeable` from dbt/contracts/util

Although we've removed the definition of `Mergeable` we've ensured the
import paths are still available. We do this because this is under
`contracts`, and the sudden disappearance from the import path might
cause issues for community members using dbt-core as a library.

Ideally we'd define a `Mergeable` class here that inherits the
`dbt-common` definition and raise a deprecation warning on instantiation.
However, we don't have an established strategy to do so.
2024-02-02 14:14:41 -08:00
Peter Webb
ef03ea2697 Use new context invocation class to cache environment variables. (#9489)
* Use new context invocation class.

* Adjust new constructor param on InvocationContext, make tests robust

* Add changelog entry.

* Clarify parameter name
2024-02-02 14:16:28 -05:00
Peter Webb
db65e627ca Integration Test Optimizations (#9499)
* Cache static objects between tests to accelerate integration runs.

* Temporarily pinning to dbt-common branch for testing.

* Add changelog entry.

* Re-pin dbt-common
2024-02-01 17:03:14 -05:00
Jeremy Cohen
1a5d6922dd Fix compiled_code, reimplement sql as wrapper (#9503)
* Fix compiled_code, reimplement sql as wrapper

* Add changelog entry
2024-02-01 16:20:54 +01:00
Quigley Malcolm
2d59a51874 Move Exposure data parts to dbt/artifacts (#9494)
* Move `ExposureType` to dbt/artifacts

* Move `MaturityType` to dbt/artifacts

* Move `ExposureConfig` to dbt/artifacts

* Move data parts of `Exposure` node class to dbt/artifacts

* Update leftover incorrect imports of `Owner` resource

There were a few places in the code base that were importing `Owner`
from `unparsed` or `nodes`. The places importing from `unparsed` were
working because `unparsed` itself was correctly importing from
`artifacts.resources`. However in places where it was being imported
from `nodes`, an exception was being raised because in the previous
commit we removed the import of `Owner` in `nodes` because it was
no longer needed.
2024-01-31 18:38:42 -08:00
Quigley Malcolm
0836095a57 Move SemanticModel data artifacts to dbt/artifacts (#9485)
* Move `SemanticModel` sub dataclasses to dbt/artifacts

* Move `NodeRelation` to dbt/artifacts

* Move `SemanticModelConfig` to dbt/artifacts

* Move data portion of `SemanticModel` to dbt/artifacts

* Add contextual comments to `semantic_model.py` about DSI protocols

* Fixup mypy complaint

* Migrate v12 manifest to use artifact definitions of `SavedQuery`, `Metric`, and `SemanticModel`

* Convert `SemanticModel` and `Metric` resources to full nodes in selector search

In the `search` method in `selector_methods.py`, we were getting object
representations from the incoming writable manifest by unique id. What we
get from the writable manifest though is increasingly the `resource`
(data artifact) part of the node, not the full node. This was problematic
because a number of the selector processes _compare_ the old node to the
new node, but the `resource` representation doesn't have the comparator
methods.

In this commit we dict-ify the resource and then get the full node by
undictifying that. We should probably have a better built in process to
the full node objects to do this, but this will do for now.

* Add `from_resource` implementation on `BaseNode` to ease resource to node conversion

We want to easily be able to create nodes from their resource counter
parts. It's actually imperative that we can do so. The previous commit
had a manual way to do so where needed. However, we don't want to have
to put `from_dict(.to_dict())` everywhere. So here we hadded a `from_resource`
class method to `BaseNode`. Everything that inherits from `BaseNode` thus
automatically gets this functionality.

HOWEVER, the implementation currently has a problem. Specifically, the
type for `resource_instance` is `BaseResource`. Which means if one is
calling say `Metric.from_resource()`, one could hand it a `SemanticModelResource`
and mypy won't complain. In this case, a semi-cryptic error might get
raised at runtime. Whether or not an error gets raised depends entirely
on whether or not the dictified resource instance manages to satisfy all
the required attributes of the desired node class. THIS IS VERY BAD.

We should be able to solve this issue in an upcoming (hopefully next)
commit, wherein we genericize `BaseNode` such that when inheriting it
you declare it with a resource type. Technically a runtime error will
still be possible, however any mixups should be caught by mypy on
pre-commit hooks as well as PRs.

* Make `BaseNode` a generic that is defined with a `ResourceType`

Turning `BaseNode` into an ABC generic allows us to say that the inheriting
class can define what resource type from artifacts it should be used with.
This gives us added type safety to what resource type can be passed into
`from_resource` when called via `SemanticModel.from_resource(...)`,
`Metric.from_resource(...)`, and etc.

NOTE: This only gives us type safety from mypy. If we begin ignoring
mypy errors during development, we can still get into a situation for
runtime errors (it's just harder to do so now).
2024-01-31 16:50:50 -08:00
Chenyu Li
87178287c7 Fix python model parsing from meder (#9162)
* fix: parsing f-strings in python models

* add unittest

* changelong

* pre-commit

---------

Co-authored-by: Meder Kamalov <meder@kamalov.net>
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2024-01-31 14:38:40 -08:00
Mike Alfare
dc3f60801e Fix Docker release to correctly publish latest and 1.x.latest tags (#9495)
* simplify and modularize tagging logic
* change package field to dropdown, log inputs to publish, skip actual publish for testing
* add dry run option
* update to v3 of docker actions to migrate from node16 (deprecated) to node20
2024-01-31 12:58:43 -05:00
Jeremy Cohen
9c8b28aa64 Manifest upgrade_schema_version runs upgrade script on all older versions (#9488)
* Make test fail correctly

* Manifest upgrade_schema_version runs on any older version

* Add changelog entry
2024-01-30 22:59:22 +01:00
Michelle Ark
719a50cc91 Fix source seed selection docs generate (#9454) 2024-01-30 16:38:25 -05:00
Jeremy Cohen
7a410ab228 Fix plurals in FoundStats message (#9465)
* Pluralize object instead of string

* Refactor print_compile_stats

* Add changie entry

* type annotations

* The plural of NodeType.Test is 'data_tests'

* Fix failing tests

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2024-01-30 12:38:08 +01:00
Quigley Malcolm
98bbbc126b Move data portions of Metric node to dbt/artifacts (#9484)
* Move `MetricInputMeasure` to dbt/artifacts

* Move `MetricTimeWindow` to dbt/artifacts

* Move `MetricInput` to dbt/artifacts

* Move `ConstantPropertyInput` and `ConversionTypeParams` to dbt/artifacts

* Move `MetricTypeParams` to dbt/artifacts

* Remove obsolete `MetricReference` class from core

The `MetricReference` defined in `nodes.py` is from pre core 1.6 metrics,
i.e. the legacy semantic layer prior to integrating with MetricFlow. I
double checked and found that this `MetricReference` is found _nowhere_
in core. It is dead, with no plan of coming back. Thus deleting it seems
logical.

* Move `MetricConfig` to dbt/artifacts

* Move data portion of `Metric` node to dbt/artifacts

* Move `depends_on_nodes` and `search_name` back to core `Metric` implementation

I got a little too indiscriminate in what got moved in the `Metric`
definition split in the previous commit. Specifically `depends_on_nodes`
and `search_name` shouldn't have been moved to `dbt/artifacts` as they
are specific core internals, not artifacts to be depended on.

* Add context comment to `metric.py` artifact file about upstream protocols.
2024-01-29 14:49:50 -08:00
Michelle Ark
06e55bb93e TestGenerateCatalogWithExternalNodes (#9456) 2024-01-29 14:42:59 -05:00
Quigley Malcolm
3e2ec1601b Move SavedQuery data artifact to dbt/artifacts (#9460)
* Move the common semantic layer node components to v1 artifact resources

* Move `FileSlice` and `SourceFileMetadata` to `semantic_layer_components` in artifacts

* Split `GraphNode` into a functional class in core and data class in artifacts

* Refactor the `same_context` checks of `Exports` into `SavedQuery`

This is important because we want to move the `Export` class to artifacts.
However, because it had functional parts we would have split it in half,
with the data definition exists in artifacts and the functional specification
defined in core. At first glance thats not problematic. However, the
`SavedQuery` definition in artifacts would only be able to point at the
data definition of `Export`, and then the function `SavedQuery` spec in
core would have to override that with the functional `Export` definition
that exists in core. This would make the inheritance rather wonky and
confusing. This refactor simplifies thigs greatly because now we can move
the entirety of `Export` to artifacts, and the core `SavedQuery` won't
have to override anything.

* Move child components of `SavedQuery` to artifacts

Specifically the components in `contracts/graph/saved_queries.py` which
are `Export`, `ExportConfig`, and `QueryParams` got moved to
`artifacts/resources/v1/saved_query.py`. The moving of `Export` was
made possible by the refactor in the previous commit.

* Move `SavedQueryMandatory` to dbt/artifacts

* Move `SavedQueryConfig` to dbt/artifacts

* Move `DependsOn` class to artifacts

If we had followed the general paradigm we've set, we would have split
`DependsOn` into a data half and a functional half, with the data half
going in artifacts. However, doing so overly complicates the work that
we're doing. Additionally looking forward, we hope to simplify the
`DependsOn` (as well as `MacroDependsOn`) to use `sets` instead of
`lists`, thus allowing us to get rid of the fuctional part. We haven't
done that refactor here because there is a reasonable amount of risk
associated with such a change such that doign so should be it's own
segement of work.

* Move `NodeVersion` and `RefArgs` to dbt/artifacts

I debated about making this two commits. However I only realized we
needed to also move `NodeVersion` when I was most the way through
moving `RefArgs`, and instead of stashing, I just decided to due both.
They're kind of inseparable anyways because it only makes sense to
move `NodeVersion` if you move `RefArgs`, but you can't move `RefArgs`
unless you also move `NodeVersion`. The two in one commit are still
small enough that I'm okay with this.

* Move data portion of `SavedQuery` class to dbt/artifacts
2024-01-29 09:07:11 -08:00
Gerda Shank
5ae8f6aad7 Enable unit testing versioned models (#9421) 2024-01-29 11:08:36 -05:00
Kshitij Aranke
1cbc6d333d Remove pytest-csv from dev-requirements.txt (#9473) 2024-01-29 15:37:05 +00:00
Tania
3bf148c443 OSS Standardization (#9316)
* Update implementation-ticket.yml

Changed "Notion docs" to "documentations"

* Added changelog

* modified the contributing and readme files.

* fixed end of files as test failed on previous commit.

* fixed the test errors.

* Changes as per reviewer's request have been made.

* some changes idk

* Update .changes/unreleased/Under the Hood-20240109-091856.yaml

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

* Update .github/ISSUE_TEMPLATE/implementation-ticket.yml

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

* Update .github/ISSUE_TEMPLATE/implementation-ticket.yml

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

---------

Co-authored-by: Tania <tonayya@users.noreply.github.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2024-01-26 14:48:46 -06:00
Michelle Ark
77d48cc27a Define Macro and Group resources in dbt/artifacts (#9439) 2024-01-26 15:28:05 -05:00
Emily Rockman
6663846026 update dependencies (#9452)
* update dependencies

* add back docutils
2024-01-25 13:39:51 -06:00
Michelle Ark
bb2017a839 update contributing expectations for external PR reviews (#9451) 2024-01-25 12:58:10 -05:00
Emily Rockman
bdcf264963 Update release.yml to use correct var (#9450) 2024-01-25 16:54:18 +00:00
Chenyu Li
50b85a0b01 fix retry as CLI (#9443) 2024-01-24 15:43:53 -08:00
Michelle Ark
ad723a6db8 Move WritableManifest to dbt/artifacts (#9377) 2024-01-24 11:57:24 -05:00
Emily Rockman
f1f0c38c55 Simplify core release inputs (#9429)
* simplify release inputs

* fix vars

* add missing quote:

* drop all env vars since the workflows dont like them

* Update .github/workflows/release.yml
2024-01-24 08:10:11 -06:00
Emily Rockman
07c40d6574 clean up workflows (#9428) 2024-01-24 08:09:45 -06:00
colin-rogers-dbt
2f2e0cee10 delete dbt/adapters and add dbt-adapters package (#9401)
* delete dbt/adapters

* update dbt-adapters requirement

* fix dev-requirements.txt

* update dev-requirements.txt

* add changie
2024-01-23 13:23:40 -08:00
Michelle Ark
dc59c706ff Feature/source freshness hooks (#9366)
Co-authored-by: Ofek Weiss <ofek1weiss@gmail.com>
2024-01-23 15:20:51 -05:00
Emily Rockman
cc7170dead add decorator (#9427)
* add decorator

* changelog
2024-01-23 12:53:23 -06:00
Peter Webb
af188624d5 Refactor macro contexts. (#9423)
* Refactor macro contexts.

* Changelog entry

* Fix an unify type annotations

* Further type annotation fixes.

* More type annotation fixing.

* Remove unused import

* Remove unused import
2024-01-23 12:23:59 -05:00
Doug Beatty
c547aace36 Align with order of unit test output when actual differs from expected (#9406)
* Align with order of unit test output when `actual` differs from `expected`

* Changelog entry
2024-01-22 13:30:38 -07:00
Jeremy Cohen
2a5ad17e6d Rename tests -> data_tests for model-level + versions (#9412)
* Rename tests -> data_tests for model-level + versions

* Add functional tests. Fix source table-level tests

* Add changie entry
2024-01-22 21:23:34 +01:00
dependabot[bot]
cd8b652568 Bump actions/download-artifact from 3 to 4 (#9374)
* Bump actions/download-artifact from 3 to 4

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-01-22 14:00:59 -06:00
Quigley Malcolm
eecaee1fe6 Ensure unit test models can depend on external nodes (#9343)
* Add unit test that shows unit tests work with external nodes

* Abbreviate in names in external nodes test to stay under 64 character postgres max

Was getting test failures due to resulting lengthy model names being created
by unit test task in the functional test

* Fix unit test parsing to ensure external nodes continue to keep their package name

* Add seed to test of external node unit test, and indirectly have the external node point to it

Previously I was getting an error about the columns for the external model
not being fetchable from the database via the macro `get_columns_in_relation`.
By creating a seed for the tests, which creates a table in postgres, we can then
tell the external model that it's database schema and identifier (the relation)
is that table from the seed without make the seed an actual dependency of the
external model in the dag.

* Ensure all models in unit test shadow manifest have a non `None` path

External nodes generally don't have paths, but in unit tests we write out
all models to sql files (as this allows us to test them). Thus external
nodes need to have their paths set.

* Add `run` step to function test of unit test with external nodes

This is necessary because when executing a unit tests, the columns
associated with a model in the database are retrieved. For this to
be possible, the model must exist in the database, thus we must
run the associated models at least once first.

* Create a full external package for function test of a unit test with an external node

Previously we were only pseudo creating an external package for testing
how unit tests work with external nodes. This was problematic because the
package didn't actually exist and thus wasn't seen as accessible when running
through dag dependencies. By actually creating the external package, we
ensure that all the built in normal processes happen.

* Add test for more ephemoral external models

* Flip logic in `packages_for_node` to remove error case

By flipping the logic from `not in` to `in` we can drop the exception
and instead default to the model runtime config when the package isn't
found. We're still trying to grok if there will be any fallout from this.
The tests all pass, but that doesn't guarantee nothing bad will happen.

* Add changie doc for added support of external nodes in unit tests
2024-01-22 09:04:46 -08:00
dependabot[bot]
d3f412daab Bump actions/checkout from 3 to 4 (#8781)
* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-01-22 10:54:43 -06:00
Michelle Ark
0da5dfecbb Support longer unit test names + improve error handling in unit test construction (#9396) 2024-01-18 10:36:19 -05:00
Emily Rockman
dc47f6b7b9 pin dbt-common (#9398)
* pin dbt-common

* Update pinned version
2024-01-17 15:56:00 -06:00
Jeremy Cohen
321031cb47 Refactor deferral: always merge_from_artifact & support all commands (#9040)
* Combine merge_from_artifact + add_from_artifact

* All commands support --defer

* Add changelog entry

* Fix mutually exclusive flag detection

* Clone doesnt require --defer

* nits: update comment + test name

* only write manifest if write_json is true

* add indirect_selection as global_flag

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2024-01-17 10:24:49 +01:00
Gerda Shank
b5a0c4c228 Unit testing feature branch pull request (#8411)
* Initial implementation of unit testing (from pr #2911)

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>

* 8295 unit testing artifacts (#8477)

* unit test config: tags & meta (#8565)

* Add additional functional test for unit testing selection, artifacts, etc (#8639)

* Enable inline csv format in unit testing (#8743)

* Support unit testing incremental models (#8891)

* update unit test key: unit -> unit-tests (#8988)


* convert to use unit test name at top level key (#8966)

* csv file fixtures (#9044)

* Unit test support for `state:modified` and `--defer` (#9032)

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>

* Allow use of sources as unit testing inputs (#9059)

* Use daff for diff formatting in unit testing (#8984)

* Fix #8652: Use seed file from disk for unit testing if rows not specified in YAML config (#9064)

Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com>
Fix #8652: Use seed value if rows not specified

* Move unit testing to test and build commands (#9108)

* Enable unit testing in non-root packages (#9184)

* convert test to data_test (#9201)

* Make fixtures files full-fledged members of manifest and enable partial parsing (#9225)

* In build command run unit tests before models (#9273)

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
2024-01-16 17:37:43 -05:00
Emily Rockman
15704ab3d5 remove dbt/common req in favor of dbt-common dependency (#9368)
* replace dbt/common with dbt-common

* update requirements, remove colorama

* remove dbt-common unit tests

* WIP

* some cleanup

* update imports from dbt.common to dbt_common

* remove tests/unit/common

* changelog entry

* remove commented out code

* move cache exceptions to dbt/adapters (#9361)

* point to dbt-common main

* Move the contents of dbt.contracts.results to a new dbt.artifacts directory (#9350)

* conflict resolution cleanup

* cleanup

* add ignoreb

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com>
Co-authored-by: Gerda Shank <gerda@dbtlabs.com>
2024-01-16 13:39:53 -06:00
Michelle Ark
a1f78a8f62 Revert "replace dbt/common with dbt-common" (#9365) 2024-01-12 11:08:39 -05:00
Michelle Ark
00f4a25bdc replace dbt/common with dbt-common (#9342) 2024-01-12 10:19:51 -05:00
Gerda Shank
cff0b65b01 Move the contents of dbt.contracts.results to a new dbt.artifacts directory (#9350) 2024-01-11 14:58:34 -05:00
Michelle Ark
0726df85eb move cache exceptions to dbt/adapters (#9361) 2024-01-11 09:58:56 -05:00
Chenyu Li
1e4286a62d Fix full-refresh and vars for retry (#9328)
Co-authored-by: Peter Allen Webb <peter.webb@dbtlabs.com>
2024-01-10 09:06:06 -08:00
dependabot[bot]
84dfb22cd5 Bump actions/setup-python from 4 to 5 (#9267)
* Bump actions/setup-python from 4 to 5

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2024-01-08 14:03:55 -08:00
Emily Rockman
34d8ac7c6e Update implementation-ticket.yml (#9349)
* Update implementation-ticket.yml

* Update .github/ISSUE_TEMPLATE/implementation-ticket.yml

* fix key
2024-01-08 15:08:43 -06:00
Michelle Ark
125982a4ad generalize BaseConfig.update_from + call adapter factory methods in core (#9335) 2024-01-05 13:54:16 -05:00
Michelle Ark
43136bbfb6 Decouple warn error options from core and adapters (#9338) 2024-01-05 13:52:11 -05:00
Michelle Ark
11cc71b75f Decouple core exceptions from common (#9333) 2024-01-04 14:45:12 -05:00
Gerda Shank
e42b7ca214 Move UserConfig to dbt_project.yml and rename to ProjectFlags (#9289) 2024-01-04 10:32:07 -05:00
Michelle Ark
48d9a67aaa move events only used by core from dbt/common/events to dbt/events (#9326) 2024-01-04 08:30:04 -05:00
Michelle Ark
7763212297 Feature/decouple adapters from core (#8906)
* remove dbt.contracts.connection imports from adapter module

* Move events to common (#8676)

* Move events to common

* More Type Annotations (#8536)

* Extend use of type annotations in the events module.

* Add return type of None to more __init__ definitions.

* Still more type annotations adding -> None to __init__

* Tweak per review

* Allow adapters to include python package logging in dbt logs (#8643)

* add set_package_log_level functionality

* set package handler

* set package handler

* add logging about stting up logging

* test event log handler

* add event log handler

* add event log level

* rename package and add unit tests

* revert logfile config change

* cleanup and add code comments

* add changie

* swap function for dict

* add additional unit tests

* fix unit test

* update README and protos

* fix formatting

* update precommit

---------

Co-authored-by: Peter Webb <peter.webb@dbtlabs.com>

* fix import

* move types_pb2.py from events to common/events

* move agate_helper into common

* Add utils module (#8910)

* moving types_pb2.py to common/events

* split out utils into core/common/adapters

* add changie

* remove usage of dbt.config.PartialProject from dbt/adapters (#8909)

* remove usage of dbt.config.PartialProject from dbt/adapters

* add changie

---------

Co-authored-by: Colin <colin.rogers@dbtlabs.com>

* move agate_helper unit tests under tests/unit/common

* move agate_helper into common (#8911)

* move agate_helper into common

* add changie

---------

Co-authored-by: Colin <colin.rogers@dbtlabs.com>

* remove dbt.flags.MP_CONTEXT usage in dbt/adapters (#8931)

* remove dbt.flags.LOG_CACHE_EVENTS usage in dbt/adapters (#8933)

* Refactor Base Exceptions (#8989)

* moving types_pb2.py to common/events

* Refactor Base Exceptions

* update make_log_dir_if_missing to handle str

* move remaining adapters exception imports to common/adapters
---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>

* Remove usage of dbt.deprecations in dbt/adapters, enable core & adapter-specific (#9051)

* Decouple adapter constraints from core (#9054)

* Move constraints to dbt.common

* Move constraints to contracts folder, per review

* Add a changelog entry.

* move include/global_project to adapters (#8930)

* remove adapter.get_compiler (#9134)

* Move adapter logger to adapters (#9165)

* moving types_pb2.py to common/events

* Move AdapterLogger to adapter folder

* add changie

* delete accidentally merged types_pb2.py

* Move the semver package to common and alter references. (#9166)

* Move the semver package to common and alter references.

* Alter leftover references to dbt.semver, this time using from syntax.

---------

Co-authored-by: Mila Page <versusfacit@users.noreply.github.com>

* Refactor EventManager setup and interaction (#9180)

* moving types_pb2.py to common/events

* move event manager setup back to core, remove ref to global EVENT_MANAGER and clean up event manager functions

* move invocation_id from events to first class common concept

* move lowercase utils to common

* move lowercase utils to common

* ref CAPTURE_STREAM through method

* add changie

* first pass: adapter migration script (#9160)

* Decouple macro generator from adapters (#9149)

* Remove usage of dbt.contracts.relation in dbt/adapters (#9207)

* Remove ResultNode usage from connections (#9211)

* Add RelationConfig Protocol for use in Relation.create_from (#9210)

* move relation contract to dbt.adapters

* changelog entry

* first pass: clean up relation.create_from

* type ignores

* type ignore

* changelog entry

* update RelationConfig variable names

* Merge main into feature/decouple-adapters-from-core (#9240)

* moving types_pb2.py to common/events

* Restore warning on unpinned git packages (#9157)

* Support --empty flag for schema-only dry runs (#8971)

* Fix ensuring we produce valid jsonschema artifacts for manifest, catalog, sources, and run-results (#9155)

* Drop `all_refs=True` from jsonschema-ization build process

Passing `all_refs=True` makes it so that Everything is a ref, even
the top level schema. In jsonschema land, this essentially makes the
produced artifact not a full schema, but a fractal object to be included
in a schema. Thus when `$id` is passed in, jsonschema tools blow up
because `$id` is for identifying a schema, which we explicitly weren't
creating. The alternative was to drop the inclusion of `$id`. Howver, we're
intending to create a schema, and having an `$id` is recommended best
practice. Additionally since we were intending to create a schema,
not a fractal, it seemed best to create to full schema.

* Explicity produce jsonschemas using DRAFT_2020_12 dialect

Previously were were implicitly using the `DRAFT_2020_12` dialect through
mashumaro. It felt wise to begin explicitly specifying this. First, it
is closest in available mashumaro provided dialects to what we produced
pre 1.7. Secondly, if mashumaro changes its default for whatever reason
(say a new dialect is added, and mashumaro moves to that), we don't want
to automatically inherit that.

* Bump manifest version to v12

Core 1.7 released with manifest v11, and we don't want to be overriding
that with 1.8. It'd be weird for 1.7 and 1.8 to both have v11 manifests,
but for them to be different, right?

* Begin including schema dialect specification in produced jsonschema

In jsonschema's documentation they state
> It's not always easy to tell which draft a JSON Schema is using.
> You can use the $schema keyword to declare which version of the JSON Schema specification the schema is written to.
> It's generally good practice to include it, though it is not required.

and

> For brevity, the $schema keyword isn't included in most of the examples in this book, but it should always be used in the real world.

Basically, to know how to parse a schema, it's important to include what
schema dialect is being used for the schema specification. The change in
this commit ensures we include that information.

* Create manifest v12 jsonschema specification

* Add change documentation for jsonschema schema production fix

* Bump run-results version to v6

* Generate new v6 run-results jsonschema

* Regenerate catalog v1 and sources v3 with fixed jsonschema production

* Update tests to handle bumped versions of manifest and run-results

---------

Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com>
Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>

* Move BaseConfig to Common (#9224)

* moving types_pb2.py to common/events

* move BaseConfig and assorted dependencies to common

* move ShowBehavior and OnConfigurationChange to common

* add changie

* Remove manifest from catalog and connection method signatures (#9242)

* Add MacroResolverProtocol, remove lazy loading of manifest in adapter.execute_macro (#9243)

* remove manifest from adapter.execute_macro, replace with MacroResolver + remove lazy loading

* rename to MacroResolverProtocol

* pass MacroResolverProtcol in adapter.calculate_freshness_from_metadata

* changelog entry

* fix adapter.calculate_freshness call

* pass context to MacroQueryStringSetter (#9248)

* moving types_pb2.py to common/events

* remove manifest from adapter.execute_macro, replace with MacroResolver + remove lazy loading

* rename to MacroResolverProtocol

* pass MacroResolverProtcol in adapter.calculate_freshness_from_metadata

* changelog entry

* fix adapter.calculate_freshness call

* pass context to MacroQueryStringSetter

* changelog entry

---------

Co-authored-by: Colin <colin.rogers@dbtlabs.com>

* add macro_context_generator on adapter (#9251)

* moving types_pb2.py to common/events

* remove manifest from adapter.execute_macro, replace with MacroResolver + remove lazy loading

* rename to MacroResolverProtocol

* pass MacroResolverProtcol in adapter.calculate_freshness_from_metadata

* changelog entry

* fix adapter.calculate_freshness call

* add macro_context_generator on adapter

* fix adapter test setup

* changelog entry

* Update parser to support conversion metrics (#9173)

* added ConversionTypeParams classes

* updated parser for ConversionTypeParams

* added step to populate input_measure for conversion metrics

* version bump on DSI

* comment back manifest generating line

* updated v12 schemas

* added tests

* added changelog

* Add typing for macro_context_generator, fix query_header_context

---------

Co-authored-by: Colin <colin.rogers@dbtlabs.com>
Co-authored-by: William Deng <33618746+WilliamDee@users.noreply.github.com>

* Pass mp_context to adapter factory (#9275)

* moving types_pb2.py to common/events

* require core to pass mp_context to adapter factory

* add changie

* fix SpawnContext annotation

* Fix include for decoupling (#9286)

* moving types_pb2.py to common/events

* fix include path in MANIFEST.in

* Fix include for decoupling (#9288)

* moving types_pb2.py to common/events

* fix include path in MANIFEST.in

* add index.html to in MANIFEST.in

* move system client to common (#9294)

* moving types_pb2.py to common/events

* move system.py to common

* add changie update README

* remove dbt.utils from semver.py

* remove aliasing connection_exception_retry

* Update materialized views to use RelationConfigs and remove refs to dbt.utils (#9291)

* moving types_pb2.py to common/events

* add AdapterRuntimeConfig protocol and clean up dbt-postgress core imports

* add changie

* remove AdapterRuntimeConfig

* update changelog

* Add config field to RelationConfig (#9300)

* moving types_pb2.py to common/events

* add config field to RelationConfig

* merge main into feature/decouple-adapters-from-core (#9305)

* moving types_pb2.py to common/events

* Update parser to support conversion metrics (#9173)

* added ConversionTypeParams classes

* updated parser for ConversionTypeParams

* added step to populate input_measure for conversion metrics

* version bump on DSI

* comment back manifest generating line

* updated v12 schemas

* added tests

* added changelog

* Remove `--dry-run` flag from `dbt deps` (#9169)

* Rm --dry-run flag for dbt deps

* Add changelog entry

* Update test

* PR feedback

* adding clean_up methods to basic and unique_id tests (#9195)

* init attempt of adding clean_up methods to basic and unique_id tests

* swapping cleanup method drop of test_schema to unique_schema to test breakage on docs_generate test

* moving the clean_up method down into class BaseDocsGenerate

* remove drop relation for unique_schema

* manually define alternate_schema for clean_up as not being seen as part of project_config

* add changelog

* remove unneeded changelog

* uncomment line that generates new manifest and delete manifest our changes created

* make sure the manifest test is deleted and readd older version of manifest.json to appease test

* manually revert file to previous commit

* Revert "manually revert file to previous commit"

This reverts commit a755419e8b.

---------

Co-authored-by: William Deng <33618746+WilliamDee@users.noreply.github.com>
Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com>

* resolve merge conflict on unparsed.py (#9309)

* moving types_pb2.py to common/events

* Update parser to support conversion metrics (#9173)

* added ConversionTypeParams classes

* updated parser for ConversionTypeParams

* added step to populate input_measure for conversion metrics

* version bump on DSI

* comment back manifest generating line

* updated v12 schemas

* added tests

* added changelog

* Remove `--dry-run` flag from `dbt deps` (#9169)

* Rm --dry-run flag for dbt deps

* Add changelog entry

* Update test

* PR feedback

* adding clean_up methods to basic and unique_id tests (#9195)

* init attempt of adding clean_up methods to basic and unique_id tests

* swapping cleanup method drop of test_schema to unique_schema to test breakage on docs_generate test

* moving the clean_up method down into class BaseDocsGenerate

* remove drop relation for unique_schema

* manually define alternate_schema for clean_up as not being seen as part of project_config

* add changelog

* remove unneeded changelog

* uncomment line that generates new manifest and delete manifest our changes created

* make sure the manifest test is deleted and readd older version of manifest.json to appease test

* manually revert file to previous commit

* Revert "manually revert file to previous commit"

This reverts commit a755419e8b.

---------

Co-authored-by: William Deng <33618746+WilliamDee@users.noreply.github.com>
Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com>

* Resolve unparsed.py conflict (#9311)

* Update parser to support conversion metrics (#9173)

* added ConversionTypeParams classes

* updated parser for ConversionTypeParams

* added step to populate input_measure for conversion metrics

* version bump on DSI

* comment back manifest generating line

* updated v12 schemas

* added tests

* added changelog

* Remove `--dry-run` flag from `dbt deps` (#9169)

* Rm --dry-run flag for dbt deps

* Add changelog entry

* Update test

* PR feedback

* adding clean_up methods to basic and unique_id tests (#9195)

* init attempt of adding clean_up methods to basic and unique_id tests

* swapping cleanup method drop of test_schema to unique_schema to test breakage on docs_generate test

* moving the clean_up method down into class BaseDocsGenerate

* remove drop relation for unique_schema

* manually define alternate_schema for clean_up as not being seen as part of project_config

* add changelog

* remove unneeded changelog

* uncomment line that generates new manifest and delete manifest our changes created

* make sure the manifest test is deleted and readd older version of manifest.json to appease test

* manually revert file to previous commit

* Revert "manually revert file to previous commit"

This reverts commit a755419e8b.

---------

Co-authored-by: William Deng <33618746+WilliamDee@users.noreply.github.com>
Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com>

---------

Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com>
Co-authored-by: Peter Webb <peter.webb@dbtlabs.com>
Co-authored-by: Colin <colin.rogers@dbtlabs.com>
Co-authored-by: Mila Page <67295367+VersusFacit@users.noreply.github.com>
Co-authored-by: Mila Page <versusfacit@users.noreply.github.com>
Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>
Co-authored-by: William Deng <33618746+WilliamDee@users.noreply.github.com>
Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com>
Co-authored-by: Chenyu Li <chenyu.li@dbtlabs.com>
2023-12-22 10:08:42 -08:00
Matthew McKnight
c2bc2f009b adding clean_up methods to basic and unique_id tests (#9195)
* init attempt of adding clean_up methods to basic and unique_id tests

* swapping cleanup method drop of test_schema to unique_schema to test breakage on docs_generate test

* moving the clean_up method down into class BaseDocsGenerate

* remove drop relation for unique_schema

* manually define alternate_schema for clean_up as not being seen as part of project_config

* add changelog

* remove unneeded changelog

* uncomment line that generates new manifest and delete manifest our changes created

* make sure the manifest test is deleted and readd older version of manifest.json to appease test

* manually revert file to previous commit

* Revert "manually revert file to previous commit"

This reverts commit a755419e8b.
2023-12-12 13:09:33 -06:00
Jeremy Cohen
6e0a387205 Remove --dry-run flag from dbt deps (#9169)
* Rm --dry-run flag for dbt deps

* Add changelog entry

* Update test

* PR feedback
2023-12-11 19:11:12 +01:00
William Deng
1740df534b Update parser to support conversion metrics (#9173)
* added ConversionTypeParams classes

* updated parser for ConversionTypeParams

* added step to populate input_measure for conversion metrics

* version bump on DSI

* comment back manifest generating line

* updated v12 schemas

* added tests

* added changelog
2023-12-07 10:09:20 -08:00
Quigley Malcolm
0ab954e1af Fix ensuring we produce valid jsonschema artifacts for manifest, catalog, sources, and run-results (#9155)
* Drop `all_refs=True` from jsonschema-ization build process

Passing `all_refs=True` makes it so that Everything is a ref, even
the top level schema. In jsonschema land, this essentially makes the
produced artifact not a full schema, but a fractal object to be included
in a schema. Thus when `$id` is passed in, jsonschema tools blow up
because `$id` is for identifying a schema, which we explicitly weren't
creating. The alternative was to drop the inclusion of `$id`. Howver, we're
intending to create a schema, and having an `$id` is recommended best
practice. Additionally since we were intending to create a schema,
not a fractal, it seemed best to create to full schema.

* Explicity produce jsonschemas using DRAFT_2020_12 dialect

Previously were were implicitly using the `DRAFT_2020_12` dialect through
mashumaro. It felt wise to begin explicitly specifying this. First, it
is closest in available mashumaro provided dialects to what we produced
pre 1.7. Secondly, if mashumaro changes its default for whatever reason
(say a new dialect is added, and mashumaro moves to that), we don't want
to automatically inherit that.

* Bump manifest version to v12

Core 1.7 released with manifest v11, and we don't want to be overriding
that with 1.8. It'd be weird for 1.7 and 1.8 to both have v11 manifests,
but for them to be different, right?

* Begin including schema dialect specification in produced jsonschema

In jsonschema's documentation they state
> It's not always easy to tell which draft a JSON Schema is using.
> You can use the $schema keyword to declare which version of the JSON Schema specification the schema is written to.
> It's generally good practice to include it, though it is not required.

and

> For brevity, the $schema keyword isn't included in most of the examples in this book, but it should always be used in the real world.

Basically, to know how to parse a schema, it's important to include what
schema dialect is being used for the schema specification. The change in
this commit ensures we include that information.

* Create manifest v12 jsonschema specification

* Add change documentation for jsonschema schema production fix

* Bump run-results version to v6

* Generate new v6 run-results jsonschema

* Regenerate catalog v1 and sources v3 with fixed jsonschema production

* Update tests to handle bumped versions of manifest and run-results
2023-12-05 17:36:43 -08:00
Michelle Ark
5488dfb992 Support --empty flag for schema-only dry runs (#8971) 2023-11-29 11:06:06 -05:00
Jeremy Cohen
09355701f6 Restore warning on unpinned git packages (#9157) 2023-11-29 08:40:47 +01:00
Kshitij Aranke
c836b7585e Fix #9119: Get sources working again in dbt docs generate (#9159) 2023-11-28 18:21:44 +00:00
Jeremy Cohen
32fde75504 Fixups for deps lock file (#9147)
* Update git revision with commit SHA

* Use PackageRenderer for lock file

* add unit tests for git and tarball packages

* deepcopy unrendered_packages_data before iteration, fix remaining tests

* Add functional tests

* Add changelog entries

* Assert one more

---------

Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com>
2023-11-28 10:06:05 +01:00
Mike Alfare
81236a3dca Fix test_current_timestamp_matches_utc (#9058)
* loosen the tolerance for matching timestamps due to a slow system clock on the macos runner
* changelog
2023-11-27 13:15:20 -05:00
Michelle Ark
6d834a18ed clean up plugin readmes (#9130) 2023-11-27 11:10:26 -05:00
Peter Webb
9bb970e6ef Cache plugin modules (#9031)
* Cache plugin modules

* Add changelog entry

* Use lru_cache to keep Python 3.8 happy.
2023-11-20 17:50:16 -05:00
Jeremy Cohen
1c9cec1787 Roadmap update (Nov 2023) (#9120)
* Roadmap update (Nov 2023)

* fix typos

* Write out title

---------

Co-authored-by: Grace Goheen <53586774+graciegoheen@users.noreply.github.com>
2023-11-18 14:54:03 -05:00
Quigley Malcolm
4d02ef637b Update comment about input_measures setting in metric parsing (#9118)
In [dbt-labs/dbt-core#7984](https://github.com/dbt-labs/dbt-core/pull/7984)
we began setting a metrics `type_params.input_measures` during metric
processing post parsing. However in that PR we didn't clean up the comment
in the parser about setting `input_measures`. This is that post fact
cleanup.
2023-11-17 12:24:58 -08:00
Adam Lopez
19f027b7a7 import nested tarball package dependencies (#8855)
* detected nested dependencies in tarball dependency

* rm git changes

* add changelog entry

* update tarball to use download_and_untar

* update tests + handle package lock entry creation for tarball

* use fixes from 017faf4bd1, add download_and_untar in install step

* quote version value

* Update .changes/unreleased/Fixes-20231013-130943.yaml

Co-authored-by: Jeremy Cohen <jtcohen6@gmail.com>

* Update .changes/unreleased/Fixes-20231013-130943.yaml

---------

Co-authored-by: Emily Rockman <ebuschang@gmail.com>
Co-authored-by: Jeremy Cohen <jtcohen6@gmail.com>
2023-11-16 12:38:47 -06:00
Quigley Malcolm
ab90c777d0 Add test asserting GraphRunnableTasks attempt to cancel connections on SystemExit (#9101)
* Add test asserting GraphRunnableTasks attempt to cancel connections on SystemExit

* Add test asserting GraphRunnableTasks attempt to cancel connections on KeyboardInterrupt

* Add test asserting GraphRunnableNode doesn't try to cancel connections on generic Exception
2023-11-15 16:03:43 -08:00
Michelle Ark
3902137dfc test pinning ddtrace (#9090) 2023-11-15 17:18:56 -05:00
Michelle Ark
0131feac68 document scripts/collect-artifact-schema (#9085) 2023-11-15 16:01:30 -05:00
Quigley Malcolm
017faf4bd1 Fix dbt deps failing on tarballs (#9068)
* tarball lockfile fix

* Add changie doc for tarball deps issue

* Add integration test for ensuring tarball package specification works

This test was written _after_ the fix was commited. However, I ran this
test against main without the fix and it failed. After running the test
with the tarball fix, it passed.

* Remove unnecessary `tarball` conditional logic in `PackageConfig.validate`

We had a conditional to skip validation for a package if the package
included the `tarball` key. However, this conditional always returned
false as it was nested inside a conditional that the package had the
default `package` key, which means it's not a tarball package, but a
package package (maybe we need better differentiation here). If we need
additional validation for tarballs down the road, we should do that one
level up. At this time we have no additional validaitons to add.

* Fix typos in changie doc for tarball deps issue

* Improve tarball package test naming and add related unhappy path test

* Remove unnecessary `setUp` fixture from tarball package tests

We initially included this fixture due to copy and pasting another
test. However, this `setUp` fixture isn't actually necessary for the
tarball dependency tests.

---------

Co-authored-by: Chenyu Li <chenyu.li@dbtlabs.com>
2023-11-14 11:38:40 -08:00
Quigley Malcolm
c2f7d75e9e Support hierarchical config setting for SavedQueryExport configs (#9065)
* Add test asserting `SavedQuery` configs can be set from `dbt_project.yml`

* Allow extraneous properties in Export configs

This brings the Export config object more in line with how other config
objects are specified in the unparsed definition. It allows for specifying
of extra configs, although they won't get propagate to the final config.

* Add `ExportConfig` options to `SavedQueryConfig` options

This allows for specifying `ExportConfig` options at the `SavedQueryConfig` level.
This also therefore allows these options to be specified in the dbt_project.yml
config. The plan in the follow up commit is to merge the `SavedQueryConfig` options
into all configs of `Exports` belonging to the saved query.

There are a couple caveots to call out:
1. We've used `schema` instead of `schema_name` on the `SavedQueryConfig` despite
it being called `schema_name` on the `ExportConfig`. This is because need `schema_name`
to be the name of the property on the `ExportConfig`, but `schema` is the user facing
specification.
2. We didn't add the `ExportConfig` `alias` property to the `SavedQueryConfig` This
is because `alias` will always be specific to a single export, and thus it doesn't
make sense to allow defining it on the `SavedQueryConfig` to then apply to all
`Exports` belonging to the `SavedQuery`

* Begin inheriting configs from saved query config, and transitively from project config

Export configs will now inherit from saved query configs, with a preference
for export config specifications. That is to say an export config will inherity
a config attr from the saved query config only if a value hasn't been supplied
on the export config directly. Additionally because the saved query config has
a similar relationship with the project config, exports configs can inherit
from the project config (again with a preference for export config specifications).

* Correct conditional in export config building for map schema to schema_name

I somehow wrote a really weird, but also valid, conditional statement. Previously
the conditional was
```
if combined.get("schema") is not combined.get("schema_name") is None:
```
which basically checked whether `schema` was a boolean that didn't match
the boolean of whether `schema_name` was None. This would pretty much
always evaluate to True because `schema` should be a string or none, not
a bool, and thus would never match the right hand side. Crazy. It has now
been fixed to do the thing we want to it to do. If `schema` isn't `None`,
and `schema_name` is `None`, then set `schema_name` to have the value of
`schema`.

* Update parameter names in `_get_export_config` to be more verbose
2023-11-14 11:13:41 -08:00
colin-rogers-dbt
e24f9b3da7 Revert "[Feature] Supports non half width alphanumeric for generic test (#8203)" (#9048)
This reverts commit f45b013321.
2023-11-09 15:05:12 -08:00
Mike Alfare
b58e8e3ffc Migrate TestCatalogRelationTypes to the shared adapter tests framework (#8952)
* changelog
* move test to shared adapter zone for reuse
* add comment explaining how to configure this test case
2023-11-09 14:57:45 -05:00
d-kaneshiro
f45b013321 [Feature] Supports non half width alphanumeric for generic test (#8203)
* Supports non half width alphanumeric for generic test

* Unify conditional statements

* add CHANGELOG entries

* added test for Japanese

* Move the fix further upstream

* Remove the changes in core/dbt/task/runnable.py

* Fix accidental removal of `_` substitution character

---------

Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
2023-11-09 10:50:59 -07:00
Thomas Lento
e547c0ec64 Update typing-extensions version to >= 4.4 (#9012) 2023-11-08 16:19:28 -05:00
colin-rogers-dbt
6871fc46b5 Add drop_schema_named macro (#8868)
* add drop_schema_named

* give drop_schema_named a default
2023-11-08 12:50:25 -08:00
Ben Mosher
931b2dbe40 During node execution, also treat SystemExit as an interrupt. (#8994)
IDE worker process raises SystemExit in multiple scenarios, including user abort of a command.
2023-11-08 15:34:18 -05:00
Leo Griffiths
bb35b3eb87 fix: get_custom_database docs describe postfix when default behaviour… (#9002)
* fix: get_custom_database docs describe postfix when default behaviour is to take the custom database value directly, if provided

* Changelog entry
2023-11-07 12:34:38 -07:00
Chenyu Li
01d481bc8d Fix lock for git subduer (#9019)
* wip

* add tests

* changelog

* nits

* pr feedback

* nits
2023-11-07 13:58:56 -05:00
Gerda Shank
46b9a1d621 Support new agate Integer data_type in adapter code (#9004)
Add test for empty seed file with only headers
2023-11-07 13:43:25 -05:00
Mike Alfare
839c720e91 Use MANIFEST.in to identify package data, allows recursive include (#9021)
* changelog

* use MANIFEST.in to identify package data
2023-11-07 13:21:15 -05:00
Quigley Malcolm
d88c6987a2 Remove documentable as it isn't used anywhere (#9008) 2023-11-07 09:12:36 -08:00
Jeremy Cohen
6c1822f186 Fix back compat for run_results pre-v5 (#9009)
* Fix back compat for run_results pre-v5

* Add type annotations

* Add functional testing

* Add inline annotations

* Add changelog entry.

* Consolidate upgrade_schema_version + upgrade_run_results_json

* Restore accidentally reverted test cases

* Pre-commit fixups

---------

Co-authored-by: Peter Allen Webb <peter.webb@dbtlabs.com>
2023-11-06 16:55:36 -05:00
Anders
c7c3ac872c Update capability.py (#8842) 2023-11-06 10:42:52 -05:00
Peter Webb
7fddd6e448 Make relation filtering None-tolerant for maximal flexibility across adapters. (#8975) 2023-11-01 16:25:27 -04:00
Mike Alfare
bb21403c9e ADAP-974: Fix issue where materialized views were not showing up in catalog queries (#8945)
* changelog
* write test case demonstrating the issue
* update catalog query to reflect materialized views
2023-10-31 23:56:59 -04:00
Quigley Malcolm
ac972948b8 DSI 0.4.0 and Saved Query Exports (#8950) 2023-10-31 18:34:41 -07:00
Chenyu Li
211392c4a4 add a no-op runner for saved_query (#8937) 2023-10-31 16:43:33 -07:00
Peter Webb
7317de23a3 Fix cased comparison in catalog-retrieval function (#8940)
* Fix cased comparison in catalog-retrieval function.

* Fix cased comparison in catalog-retrieval function.
2023-10-30 11:23:41 -04:00
Peter Webb
a2a7b7d795 Fix issues around new get_catalog_by_relations macro (#8856)
* Fix issues around new get_catalog_by_relations macro

* Add changelog entry

* Fix unit test.

* Additional unit testing
2023-10-26 15:23:04 -04:00
Kshitij Aranke
4122f6c308 Fix #8836: Add version to fqn when version==0 (#8915) 2023-10-26 11:31:24 -05:00
Doug Beatty
6aeebc4c76 Handle unknown type_code for model contracts (#8887)
* Handle unknown `type_code` for model contracts

* Changelog entry

* Fix changelog entry

* Functional test for a `type_code` that is not recognized by psycopg2

* Functional tests for data type mismatches
2023-10-25 15:44:02 -06:00
Emily Rockman
98310b6612 Contract enforcement on temporary tables (#8889)
* add test

* fix test

* first pass with constraint error

* add back column checks for temp tables

* changelog

* Update .changes/unreleased/Fixes-20231024-145504.yaml
2023-10-25 11:10:36 -05:00
Emily Rockman
ef9d6a870f add 1.7 changelog (#8886) 2023-10-24 11:51:28 -05:00
Chenyu Li
35f46dac8c Fix partial parsing issue not working for changing semantic model name (#8865)
* fix

* test

* changelog
2023-10-23 09:55:58 -07:00
FishtownBuildBot
efa6339e18 Cleanup main after cutting new 1.7.latest branch (#8840) 2023-10-12 16:46:37 +01:00
FishtownBuildBot
1baebb423c [Automated] Merged prep-release/1.7.0rc1_6495873283 into target main during release process 2023-10-12 09:50:47 -04:00
Github Build Bot
462df8395e Bumping version to 1.7.0rc1 and generate changelog 2023-10-12 12:53:26 +00:00
Quigley Malcolm
35f214d9db Support dbt-semantic-interfaces 0.3.0 (#8820)
* changie doc for DSI 0.3.0 upgrade

* Gracefully handle v10 metric filters

* Fix iteration over metrics in `upgrade_v10_metric_filters`

* Update previous manifest version test fixtures to have more expressive metrics

* Regenerate the test v10 manifest artifact using the more expressive metrics from 904cc1ef

To do this I cherry-picked 904cc1ef onto my local 1.6.latest branch,
had the test regenerate the test v10 manifest artifact, and then over
wrote the test v10 manifest artifact on this branch (cherry-picking it
across the branches didn't work, had to copy paste :grimmace:)

* Regenerate test v11 manifest artifact using the fixture changes in 904cc1ef

* Update `upgrade_v10_metric_filters` to handled disabled metrics

Regenerating the v10 and v11 test manifest artifacts uncovered an
issue wherein we weren't handling disabled metrics that need to
get upgraded. This commit fixes that. Additionally, the
`upgrade_v10_metric_filters` was getting a bit unwieldy, so I broke
extracted the abstracted sub functions.

* Fix `test_backwards_compatible_versions` test

When we regenerated the v10 test manifest artifact, it started having
the `metricflow_time_sine` model, and it didn't previously. This caused
`test_backwards_compatible_versions` to start failing because it was
no longer identified as having modified state for v10. The test has
been altered accordingly
2023-10-11 16:46:26 -07:00
Quigley Malcolm
af0cbcb6a5 Add SavedQuery nodes (#8798)
* Bump to dbt-semantic-interfaces 0.3.0b1

* Update import path of `WhereFilterParser` from `dbt-semantic-interfaces`

In 0.3.x of `dbt-semantic-intefaces` the location of the WhereFilterParser
moved to be grouped in with a bunch of new adjacent code. As such,
we needed to correct our import path of it.

* Create basic `SavedQuery` node type based on `SavedQuery` protocol from DSI

* Add ability to add SavedQueries to the manifest

* Define unparsed SavedQuery node

* Begin parsing saved_query objects to manifest

* Skip jinja rendering of `SavedQuery.where` property

* Begin propagating `SavedQueries` on the manifest to the semantic manifest

* Add tests for basic saved query parsing

* Add custom pluralization handling of SavedQuery node type

* Add a config subclass to SavedQuery node

* Move the SavedQuery node to nodes.py

Unfortunately things are a bit too intertwined currently for SavedQuery
to be in it's own file. We need to add the SavedQuery node to the
GraphMemberNode, unfortunately with SavedQuery in it's own file,
importing it would have caused a circular dependency. We'll need
to separately come in and split things up as a cleanup portion of
work.

* Add basic plumbing of saved query configs to projects

* Add basic lookup utility for saved queries, SavedQueryLookup

* Handle disabled SavedQuery nodes in parsing and lookups

* Add SavedQuery nodes to grouping process

Our grouping logic seems to be in a weird spot. It seems liek we're
moving to setting the `group` for a node in the node's `config` however,
all of the logic around grouping is still focused on the top level `group`
property on a nodes. To get group stuff plumbed I've thus added `group`
as a top level property of the `SavedQuery` node, and populated it from
the config group value.

* Plumb through saved query in a lot more places

I don't like making scatter shot commits like this. However, a lot
of this commit was written ~4am, soooo yea. Things were broken, I wanted
things to be unbroken. I mostly searched for `semantic_models` and added
the equivalent necessary `saved_queries`. Some stuff is in support of
writing out the manifest, some stuff helps with node selection, it's a
lot of miscelaneous stuff that I don't fully understand.

* Add `depends_on` to `SavedQuery` nodes and populate from `metrics` property

* Add partial parsing support to SavedQuery nodes

* Add `docs` support for SavedQuery descriptions

* Support selctor methods for SavedQuery nodes

* Add `refs` property to SavedQuery node

We don't actually append anything to `refs` for SavedQuery nodes currently.
I'm not sure if anything needs to be appended to them. Regardless, we
access the `refs` property throughout the codebase while iterating over
nodes. It seems wise to support this attribute as to not accidently blow
something up with it not existing.

* Support `saved_queries` when upgrading from manifests <= v10 (and regenerate v11)

* Add changie doc for saved query node support

* Pin to dbt-semantic-interfaces 0.3.0b1 for saved query work

We're gonna release DSI 0.3.0, and if this PR automatically pulls that
in things will break. But the things that need fixing should be handled
separately from this PR. After releasing DSI 0.3.0 I'm going to create
a branch off/ontop of this one, and open a stacked PR with the associated
changes.

* Bump supported DSI version to 0.3.x

* Switch metric filters and saved query where to use ne WhereFilterIntersection

* Update schema yaml readers to create WhereFilterInterfaces

* Expand metric filters and saved query where property to handle both str and list of strs

* Update tests which were broken by where filter changes

* Regeneate v11 manifest

* Fixup: Update `SavedQueryLookup.perform_lookup` to operate on saved queries

I missed this when I was copy and pasting 🤦
2023-10-11 15:54:11 -07:00
Peter Webb
2e35426d11 Add support for getting freshness from DBMS metadata (#8795)
* Add support for getting freshness from DBMS metadata

* Add changelog entry

* Add simple test case

* Change parsing error to warning and add new event type for warning

* Code review simplification of capability dict.

* Revisions to the capability mechanism per review

* Move utility function.

* Reduce try/except scope

* Clean up imports.

* Simplify typing per review

* Unit test fix
2023-10-11 15:55:57 -04:00
Emily Rockman
bf10a29f06 update v10 manifest on main (#8834)
* update manifest

* add changelog
2023-10-11 14:52:01 -05:00
Gerda Shank
a7e2d9bc40 Partial parsing issue when adding groups and updating models at the same time (#8817) 2023-10-11 15:01:49 -04:00
Michelle Ark
a3777496b5 fix changelog (#8833) 2023-10-11 13:22:05 -04:00
dependabot[bot]
edf6aedc51 Bump docker/build-push-action from 4 to 5 (#8783)
* Bump docker/build-push-action from 4 to 5

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
2023-10-11 09:51:51 -07:00
Jeremy Cohen
53845d0277 Add warning_tag to UnversionedBreakingChange (#8828) 2023-10-11 17:54:16 +02:00
Mike Alfare
3d27483658 ADAP-850: Support test results as a view (#8653)
* add `store_failures_as` parameter to TestConfig, catch strategy parameter in test materialization
* create test results as views
* updated test expected values for new config option
* break up tests into reusable tests and adapter specific configuration, update test to check for relation type and confirm views update
* move test configuration into base test class
* allow `store_failures_as` to drive whether failures are stored
* update expected test config dicts to include the new default value for store_failures_as
* Add `store_failures_as` config for generic tests
* cover --store-failures on CLI gap
* add generic tests test case for store_failures_as
* update object names for generic test case tests for store_failures_as
* remove unique generic test, it was not testing `store_failures_as`
* pull generic run and assertion into base test class to turn tests into quasi-parameterized tests
* add ephemeral option for store_failures_as, as a way to easily turn off store_failures at the model level
* add compilation error for invalid setting of store_failures_as

---------

Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
2023-10-10 17:26:01 -04:00
Emily Rockman
4f9bd0cb38 Fix uncaught exception for group updates (#8792)
* add test

* write test

* fix test

* updating test

* add clean

* cleanup

* more tests, fix comment

* add new test, move fixtures
2023-10-10 15:37:47 -05:00
Kshitij Aranke
3f7f7de179 Fix #8682: Override path-like args in dbt retry (#8803) 2023-10-10 19:31:54 +01:00
Kshitij Aranke
6461f5aacf Fix #8022: Foreign key constraint on incremental model results in Database Error (#8768) 2023-10-10 18:32:51 +01:00
Doug Beatty
339957b42c Explanation of Parsing vs. Compilation vs. Runtime (#8744)
* Explanation of Parsing vs. Compilation vs. Runtime

* Update core/dbt/parser/parsing-vs-compilation-vs-runtime.md

* Update core/dbt/parser/parsing-vs-compilation-vs-runtime.md

* Update core/dbt/parser/parsing-vs-compilation-vs-runtime.md

* Update core/dbt/parser/parsing-vs-compilation-vs-runtime.md

* Update core/dbt/parser/parsing-vs-compilation-vs-runtime.md

* Update core/dbt/parser/parsing-vs-compilation-vs-runtime.md

* Apply suggestions from code review

Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>

* Fix a couple markdown rendering issues

* Move to the "explain it like im 64" folder

When ELI5 just isnt detailed enough.

* Disambiguate Python references

Disambiguate Python references and delineate SQL models ("Jinja-SQL") from Python models ("dbt-py")

---------

Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
2023-10-10 10:51:54 -06:00
Gerda Shank
4391dc1a63 Type aliasing for model contract column data_type (#8592) 2023-10-10 11:43:26 -04:00
Michelle Ark
964e0e4e8a [Fix] respect project root when loading seeds (#8762) 2023-10-10 11:17:41 -04:00
Chenyu Li
549dbf3390 Deps lock by justbldwn (#8408)
*  adding installed_packages.json functionality

*  update test_simple_dependency_deps test

* 📝 adding changelog for deps feature via changie

*  restructure deps command, include lock/add

*  add new deps event types to sample_values

*  fix test_simple_dependency_deps test

* 🐛 attempting to fix cli commands

* 🐛 convert dbt deps to dbt deps install

also leave dbt deps as just a new click group

*  update test_command_mutually_exclusive_option

change deps command to deps install

*  update functional tests from deps > deps install

*  change missing deps to deps install

*  convert adapter tests to deps install from deps

* move back to deps and merge more with main

* fix-unittest

* add hash

* foramt yml and update command structure

* nits

* add new param

* nits

* nits

* nits

* fix_tests

* pr_feedback

* nits

* nits

* move_check

* Update Features-20230125-165933.yaml

---------

Co-authored-by: Justin Baldwin <91483530+justbldwn@users.noreply.github.com>
2023-10-09 21:05:00 -07:00
Quigley Malcolm
70b2e15a25 Add semantic model test to test_contracts_graph_parsed.py (#8654)
* Add semantic model test to `test_contracts_graph_parsed.py`

The tests in `test_contracts_graph_parsed.py` are meant to ensure
that we can go from objects to dictionaries and back without any
changes. We've had a desire to simplify these tests. Most tests in
this file have three to four fixtures, this test only has one. What
a test of this format ensures is that parsing a SemanticModel from
a dictionary doesn't add/drop any keys from the dictionary and that
when going back to the dictionary no keys are dropped. This style of
test will still break whenever the semantic model (or sub objects)
change. However now when that happens, only one fixture will have to
be updated (whereas previously we had to update 3-4 fixtures).

* Begin using hypothesis package for symmetry testing

Hypothesis is a python package for doing property testing. The `@given`
parameterizes a test, with it generating the arguements it has following
`strategies`. The main strategies we use is `builds` this takes in a callable
passes any sub strategies for named arguements, and will try to infer any
other arguments if the callable is typed. I found that even though the
test was run many many times, some of the `SemanticModel` properties
weren't being changed. For instance `dimensions`, `entities`, and `measures`
were always empty lists. Because of this I defined sub strategies for
some attributes of `SemanticModel`s.

* Update unittest readme to have details on test_contracts_graph_parsed methodology
2023-10-09 14:55:26 -07:00
Mark Scannell
bb249d612c Generate static index html documentation (#8615)
* Include option to generate static index.html

* Added changie

* Using DBT's system load / write file methods for better cross platform
support

* Updated docs tests with dbt.client.systems calls for file reading

* Writing out static_index.html as binary file to prevent line-ending
conversions on Windows. (similar behaviour as index.html)
2023-10-06 10:37:13 -07:00
Emily Rockman
17773bdb94 pin types-requests in dev-requirements (#8788)
* pin types-requests

* changelog
2023-10-06 09:53:08 -05:00
Gerda Shank
f30293359c Selectors in docs generate limits catalog generation (#8772) 2023-10-05 16:00:12 -04:00
Emily Rockman
0c85e6149f remove guild as codeowner (#8778) 2023-10-05 10:16:32 -05:00
Emily Rockman
ec57d7af94 add gha for dependabot checks (#8777) 2023-10-05 10:16:20 -05:00
Emily Rockman
df791f729c support doc blocks (#8771) 2023-10-05 08:12:28 -05:00
Emily Rockman
c6ff3abecd remove top level meta attribute (#8766) 2023-10-04 13:23:09 -05:00
Emily Rockman
eac13e3bd3 Add meta to SemanticModels (#8754)
* WIP

* changelog
2023-10-03 13:08:37 -05:00
Emily Rockman
46ee3f3d9c rebuild manifest missed fields (#8755)
* rebuild manifest missed fields

* changelogs
2023-10-02 09:38:50 -05:00
Peter Webb
5e1f0c5fbc Report Resource Usage Statistics When a dbt Command Finishes (#8671)
* Add performance metrics to the CommandCompleted event.

* Add changelog entry.

* Add flag for controling the log level of ResourceReport.

* Update changelog entry to reflect changes

* Remove outdated attributes

* Work around missing resource module on windows

* Fix corner case where flags are not set
2023-09-29 18:37:37 -04:00
Peter Webb
c4f09b160a Add new get_catalog_relations macro, Supporting Changes (#8648)
* Add new get_catalog_relations macro, allowing dbt to specify which relations in a schema the adapter should return data about

* Implement postgres adapter support for relation filtering on catalog queries

* Code review changes adding feature flag for catalog-by-relation-list support

* Use profile specified in --profile with dbt init (#7450)

* Use profile specified in --profile with dbt init

* Update .changes/unreleased/Fixes-20230424-161642.yaml

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

* Refactor run() method into functions, replace exit() calls with exceptions

* Update help text for profile option

---------

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

* add TestLargeEphemeralCompilation (#8376)

* Fix a couple of issues in the postgres implementation of get_catalog_relations

* Add relation count limit at which to fall back to batch retrieval

* Better feature detection mechanism for adapters.

* Code review changes to get_catalog_relations and adapter feature checking

* Add changelog entry

---------

Co-authored-by: ezraerb <ezraerb@alum.mit.edu>
Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com>
2023-09-29 16:13:23 -04:00
Jeremy Cohen
48c97e86dd Fix tag: selection for projects with semantic models (#8750)
* Add unit test to repro regression

* Add defensive code for tag: selection

* Add changelog entry
2023-09-29 09:49:32 -07:00
Emily Rockman
416bc845ad fix duplication of docs issues (#8747)
* fix duplication of docs issues

* update conditional to only run on merged PRs
2023-09-29 09:40:34 -05:00
Michelle Ark
408a78985a Fix: avoid double-rendering sql_header in dbt show (#8740) 2023-09-28 19:35:14 +01:00
Emily Rockman
0c965c8115 update changelog kind (#8737) 2023-09-28 08:20:57 -07:00
Philippe Boyd
f65e4b6940 feat: resolve packages with same git repo and unique subdirectory (#8322) 2023-09-27 15:31:37 -04:00
Michelle Ark
a2d4424f92 Inline limit in SQL sent from dbt show (#8641) 2023-09-27 15:56:34 +01:00
Kshitij Aranke
997f839cd6 Disallow cleaning paths outside current working directory (#8469) 2023-09-27 15:47:00 +01:00
Emily Rockman
556fad50df Model contracts: raise warning for numeric types without specified scale (#8721)
* add warning when contracting fields don't have precision

* rename files

* changelog

* move tests out of adapter zone

* Update core/dbt/include/global_project/macros/adapters/columns.sql

Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com>

* Apply suggestions from code review

---------

Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com>
2023-09-27 08:00:12 -05:00
dave-connors-3
bb4214b5c2 Dc/8546 semantic models in graph selection (#8589) 2023-09-26 23:23:03 +01:00
Kshitij Aranke
f17c1f3fe7 Fix #6497: Support global flags passed in after subcommands (#8670) 2023-09-26 16:16:36 +01:00
Kshitij Aranke
d4fe9a8ad4 Fix #8509: Support doc blocks in nested semantic model YAML (#8709) 2023-09-26 16:02:21 +01:00
Emily Rockman
2910aa29e4 Automated Repo Cleanup (#8686)
* add workflow

* cleanup and rename workflow

* rename workflow in actions

* add more context
2023-09-26 09:35:29 -05:00
Renan Leme
89cc073ea8 CT-3144 Fix test edges type filter on Graph (#8696)
* CT-3144 Fix test edges filter

* CT-3144 Add changelog

* CT-3144 Remove duplicated line

* CT-3144 Remove duplicated line

* CT-3144 Rename vars

* CT-3144 Update filter to use get_edge_data

* Trigger cla
2023-09-26 09:55:45 -04:00
Quigley Malcolm
aa86fdfe71 Add date spine macros to core (#8616)
* Add `date_spine` macro (and macros it depends on) from dbt-utils to core

The macros added are
- date_spine
- get_intervals_between
- generate_series
- get_powers_of_two

We're adding these to core because they are becoming more prevalently used
with the increase usage in the semantic layer. Basically if you are
using the semantic layer currently, then it is almost a requirement
to use dbt-utils, which is undesireable given the SL is supported directly
in core. The primary focus of this was to just add `date_spine`. However,
because `date_spine` depends on other macros, these other macros were
also moved.

* Add adapter tests for `get_powers_of_two` macro

* Add adapter tests for `generate_series` macro

* Add adapter tests for `get_intervals_between` macro

* Add adapter tests for `date_spine` macro

* Improve test fixture for `date_spine` macro to work with multiple adapters

* Cast to types to date in fixture_date_spine when targeting redshift

* Improve test fixture for `get_intervals_between` macro to work with multiple adapters

* changie doc for adding date_spine macro
2023-09-25 12:20:05 -07:00
Quigley Malcolm
48e9ced781 Support null coalescing properties for metric nodes (#8700)
* Include 'join_to_timespine` and `fill_nulls_with` in metric fixture

* Support `join_to_timespine` and `fill_nulls_with` properties on measure inputs to metrics

* Assert new `fill_nulls_with` and `join_to_timespine` properties don't break associated DSI protocol

* Add doc for metric null coalescing improvements

* Fix unit test for unparsed metric objects

The `assert_symmetric` function asserts that dictionaries are mostly
equivalent. I say mostly equivalent because it drops keys that are
`None`. The issue is that that `join_to_timespine` gets defaulted
to `False`, so we have to specify it in the `get_ok_dict` so that
they match.
2023-09-25 11:02:47 -07:00
Doug Beatty
7b02bd1f02 Lower bound of 8.0.2 for click (#8684)
* Lower bound of `8.0.2` for `click`

* Changelog entry
2023-09-24 13:46:54 -06:00
Emily Rockman
417fc2a735 Support quoted parameter list for MultiOption cli options (#8665)
* allow multioption to be quoted

* changelog

* fix test

* remove list format

* fix tests

* fix list object

* review arg change

* fix quotes

* Update .changes/unreleased/Features-20230918-150855.yaml

* add types

* convert list to set in test

* make mypy happy

* mroe mypy happiness

* more mypy happiness

* last mypy change

* add node to test
2023-09-22 14:34:36 -05:00
Quigley Malcolm
317128f790 Update pull request template to include type annotations as part of checklist (#8687)
* Update pull request template to include type annotations as part of checklist

* Add to checklist item a link to python typing information
2023-09-22 11:30:28 -07:00
Emily Rockman
e3dfb09b10 Support labels for semantic_models, dimensions, measures and entities (#8646)
* first pass

* changelog

* changelog

* Delete .changes/unreleased/Features-20230913-155802.yaml

* Update .changes/unreleased/Features-20230914-074429.yaml
2023-09-22 10:56:57 -05:00
colin-rogers-dbt
d912654110 Allow adapters to include python package logging in dbt logs (#8643)
* add set_package_log_level functionality

* set package handler

* set package handler

* add logging about stting up logging

* test event log handler

* add event log handler

* add event log level

* rename package and add unit tests

* revert logfile config change

* cleanup and add code comments

* add changie

* swap function for dict

* add additional unit tests

* fix unit test
2023-09-20 09:27:30 -07:00
Peter Webb
34ab4cf9be More Type Annotations (#8536)
* Extend use of type annotations in the events module.

* Add return type of None to more __init__ definitions.

* Still more type annotations adding -> None to __init__

* Tweak per review
2023-09-20 11:35:22 -04:00
Michelle Ark
d597b80486 add TestLargeEphemeralCompilation (#8376) 2023-09-18 15:00:10 +01:00
ezraerb
3f5ebe81b9 Use profile specified in --profile with dbt init (#7450)
* Use profile specified in --profile with dbt init

* Update .changes/unreleased/Fixes-20230424-161642.yaml

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

* Refactor run() method into functions, replace exit() calls with exceptions

* Update help text for profile option

---------

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2023-09-15 10:14:53 -05:00
Kshitij Aranke
f52bd9287b Fix #8160: Warn when --state == --target (#8638) 2023-09-14 17:04:32 +01:00
Gerda Shank
f5baeeea1c Allow setting access in config in addition to properties (#8635) 2023-09-14 11:09:41 -04:00
Mike Alfare
3cc7044fb3 Loosen type on replaceable_relation and renameable_relation and provide guidance in docstrings (#8647)
* loosen type on replaceable_relation and renameable_relation and provide guidance in docstrings
2023-09-13 20:17:33 -04:00
Gerda Shank
26c7675c28 Fix test_numeric_values of the show test (#8644) 2023-09-13 15:38:18 -04:00
colin-rogers-dbt
8aaed0e29f replace is_replaceable function with can_be_replaced call (#8637) 2023-09-13 10:19:09 -04:00
Emily Rockman
5182e3c40c split up test class (#8610) 2023-09-12 10:59:56 -05:00
Kshitij Aranke
1e252c7664 move codecov failure threshold to 0.1% (#8625) 2023-09-12 16:45:36 +01:00
Kshitij Aranke
05ef3b6e44 Audit potential circular dependencies (#8489) 2023-09-12 14:00:16 +01:00
leahwicz
ad04012b63 Revert "Merge branch 'main' into main" (#8622)
This reverts commit c93cba4603, reversing
changes made to 971669016f.
2023-09-11 22:18:12 -04:00
leahwicz
c93cba4603 Merge branch 'main' into main 2023-09-11 21:40:10 -04:00
Mike Alfare
971669016f ADAP-869: Support atomic replace in replace macro (#8539)
* move config changes into alter.sql in alignment with other adapters
* move shared relations macros to relations root
* move single models files to models root
* add table to replace
* move create file into relation directory
* implement replace for postgres
* move column specific macros into column directory
* add unit test for can_be_replaced
* update renameable_relations and replaceable_relations to frozensets to set defaults
* fixed tests for new defaults
2023-09-11 16:23:25 -04:00
Emily Rockman
6c6f245914 update PR template (#8613) 2023-09-11 13:48:25 -05:00
Quigley Malcolm
b39eeb328c Unskip and rename test_expression_metric (#8578)
* Add docstrings to `contracts/graph/metrics.py` functions to document what they do

Used [dbt-labs/dbt-core#5607](https://github.com/dbt-labs/dbt-core/pull/5607)
for context on what the functions should do.

* Add typing to `reverse_dag_parsing` and update function to work on 1.6+ metrics

* Add typing to `parent_metrics` and `parent_metrics_names`

* Add typing to `base_metric_dependency` and `derived_metric_dependency` and update functions to work on 1.6+ metrics

* Simplify implementations of `basic_metric_dependency` and `derived_metric_dependnecy`

* Add typing to `ResolvedMetricReference` initialization

* Add typing to `derived_metric_dependency_graph`

* Simplify conditional controls in `ResolvedMetricReference` functions

The functions in `ResolvedMetricReference` use `manifest.metric.get(...)`
which will only return either a `Metric` or `None`, never a different
node type. Thus we don't need to check that the returned metric is
a metric.

* Don't recurse on over `depends_on` for non-derived metrics in `reverse_dag_parsing`

The function `reverse_dag_parsing` only cares about derived metrics,
that is metrics that depend on other metrics. Metrics only depend on
other metrics if they are one of the `DERIVED_METRICS` types. Thus
doing a recursive call to `reverse_dag_parsing` for non `DERIVED_METRICS`
types is unnecessary. Previously we were iterating over a metric's
`depends_on` property regardless of whether the metric was a `DERIVED_METRICS`
type. Now we only do this work if the metric is of a `DERIVED_METRICS`
type.

* Simplify `parent_metrics_names` by having it call `parent_metrics`

* Unskip `TestMetricHelperFunctions.test_derived_metric` and update fixture setup

* Add changie doc for metric helper function updates

* Get manifest in `test_derived_metric` from the parse dbt_run invocation

* Remove `Relation` a intiatlization attribute for `ResolvedMetricReference`

* Add return typing to class `__` functions of `ResolvedMetricReference`

* Move from `manifest.metrics.get` to `manifest.expect` in metric helpers

Previously with `manifest.metrics.get` we were just skipping when `None`
was returned. Getting `None` back was expected in that `parent_unique_id`s
that didn't belong to metrics should return `None` when calling
`manifest.metrics.get`, and these are fine to skip. However, there's
an edgecase where a `parent_unique_id` is supposed to be a metric, but
isn't found, thus returning `None`. How likely this edge case could
get hit, I'm not sure, but it's a possible edge case. Using `manifest.metrics.get`
it we can't actually tell if we're in the edge case or not. By moving
to `manifest.expect` we get the error handling built in, and the only
trade off is that we need to change our conditional to skip returned
nodes that aren't metrics.
2023-09-07 15:28:36 -07:00
Emily Rockman
be94bf1f3c Preserve decimal places for dbt show (#8561)
* update `Number` class to handle integer values (#8306)

* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

* account for integer vs number on table merges

* add tests for combining number with integer.

* add unit test when nulls are added

* cant none as an Integer

* fix null tests

---------

Co-authored-by: dave-connors-3 <73915542+dave-connors-3@users.noreply.github.com>
Co-authored-by: Dave Connors <dave.connors@fishtownanalytics.com>
2023-09-07 09:15:11 -05:00
Ben Mosher
e24a952e98 compile --no-inject-ephemeral-ctes flag (#8482) 2023-09-07 10:13:40 -04:00
Michelle Ark
89f20d12cf make UnparsedVersion.__lt__ order-agnostic (#8559) 2023-09-06 17:46:59 -04:00
Michelle Ark
ebeb0f1154 test advanced ref override (#8552) 2023-09-06 17:45:16 -04:00
Kshitij Aranke
d66fe214d9 Fix #8544: Parse the correct schema version from manifest (#8551)
* Fix #8544: Parse the correct schema version from manifest

* add changie

* add comment
2023-09-06 20:38:37 +01:00
Michelle Ark
75781503b8 add typing to partially typed methods in runnable.py (#8569) 2023-09-06 13:57:55 -04:00
Kshitij Aranke
9aff3ca274 Fix #8398: Add typing to __init__ in base.py (#8568) 2023-09-06 18:13:05 +01:00
Emily Rockman
7e2a08f3a5 remove label (#8557) 2023-09-05 19:12:16 -05:00
Emily Rockman
a0e13561b1 Support dbt-cloud config dict in dbt_project.yml (#8527)
* first pass at adding dbt-cloud config

* changelog

* fix test, add direct validation
2023-09-05 09:48:37 -05:00
FishtownBuildBot
7eedfcd274 [Automated] Merged prep-release/1.7.0b2_6049623160 into target main during release process 2023-09-01 08:48:37 -05:00
Github Build Bot
da779ac77c Bumping version to 1.7.0b2 and generate changelog 2023-09-01 12:51:37 +00:00
Mike Alfare
adfa3226e3 ADAP-814: Add support for replacing materialized views with tables/views and vice versa (#8449)
* first draft of adding in table - materialized view swap
* table/view/materialized view can all replace each other
* update renameable relations to a config
* migrate relations macros from `macros/adapters/relations` to `macros/relations` so that generics are close to the relation specific macros that they reference; also aligns with adapter macro files structure, to look more familiar
* move drop macro to drop macro file
* align the behavior of get_drop_sql and drop_relation, adopt existing default from drop_relation
* add explicit ddl for drop statements instead of inheriting the default from dbt-core
* update replace macro dependent macros to align with naming standards
* update type for mashumaro, update related test
2023-08-31 20:41:45 -04:00
Quigley Malcolm
e5e1a272ff Fix untyped functions in core/dbt/context/base.py (#8525)
* Improve typing of `ContextMember` functions

* Improve typing of `Var` functions

* Improve typing of `ContextMeta.__new__`

* Improve typing `BaseContext` and functions

In addition to just adding parameter typing and return typing to
`BaseContext` functions. We also declared `_context_members_` and
`_context_attrs_` as properites of `BaseContext` this was necessary
because they're being accessed in the classes functions. However,
because they were being indirectly instantiated by the metaclass
`ContextMeta`, the properties weren't actually known to exist. By
adding declaring the properties on the `BaseContext`, we let mypy
know they exist.

* Remove bare `invocations` of `@contextmember` and `@contextproperty`, and add typing to them

Previously `contextmember` and `contextproperty` were 2-in-1 decorators.
This meant they could be invoked either as `@contextmember` or
`@contextmember('some_string')`. This was fine until we wanted to return
typing to the functions. In the instance where the bare decorator was used
(i.e. no `(...)` were present) an object was expected to be returned. However
in the instance where parameters were passed on the invocation, a callable
was expected to be returned. Putting a union of both in the return type
made the invocations complain about each others' return type. To get around this
we've dropped the bare invocation as acceptable. The parenthesis are now always
required, but passing a string in them is optional.
2023-08-31 13:34:57 -07:00
Gerda Shank
d8e8a78368 Fix snapshot success message to display "INSERT 0 1" (for example) instead of success (#8524) 2023-08-31 13:09:15 -04:00
Emily Rockman
7ae3de1fa0 Semantic model configs - enable/disable + groups (#8502)
* WIP

* WIP

* get group and enabled added

* changelog

* cleanup

* getting measure lookup working

* missed file

* get project level working

* fix last test

* add groups to config tests

* more group tests

* fix path

* clean up manifest.py

* update error message

* fix test assert

* remove extra check

* resolve conflicts in manaifest

* update manifest

* resolve conflict

* add alias
2023-08-30 20:18:22 -05:00
Gerda Shank
72898c7211 Add return value to AdapterContainer.__init__ and AdapterMeta.__new__ (#8523) 2023-08-30 17:37:32 -04:00
Peter Webb
fc1a14a0e3 Include Compiled Node Attributes in run_results.json (#8492)
* Add compiled node properties to run_results.json

* Include compiled-node attributes in run_results.json

* Fix typo

* Bump schema version of run_results

* Fix test assertions

* Update expected run_results to reflect new attributes

* Code review changes

* Fix mypy warnings for ManifestLoader.load() (#8443)

* revert python version for docker images (#8445)

* revert python version for docker images

* add comment to not update python version, update changelog

* Bumping version to 1.7.0b1 and generate changelog

* [CT-3013]  Fix parsing of `window_groupings` (#8454)

* Update semantic model parsing tests to check measure non_additive_dimension spec

* Make `window_groupings` default to empty list if not specified on `non_additive_dimension`

* Add changie doc for `window_groupings`  parsing fix

* update `Number` class to handle integer values (#8306)

* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>

* Improve docker image README (#8212)

* Improve docker image README

- Fix unnecessary/missing newline escapes
- Remove double whitespace between parameters
- 2-space indent for extra lines in image build commands

* Add changelog entry for #8212

* ADAP-814: Refactor prep for MV updates (#8459)

* apply reformatting changes only for #8449
* add logging back to get_create_materialized_view_as_sql
* changie

* swap trigger (#8463)

* update the implementation template (#8466)

* update the implementation template

* add colon

* Split tests into classes (#8474)

* add flaky decorator

* split up tests into classes

* revert update agate for int (#8478)

* updated typing and methods to meet mypy standards (#8485)

* Convert error to conditional warning for unversioned contracted model, fix msg format (#8451)

* first pass, tests need updates

* update proto defn

* fixing tests

* more test fixes

* finish fixing test file

* reformat the message

* formatting messages

* changelog

* add event to unit test

* feedback on message structure

* WIP

* fix up event to take in all fields

* fix test

* Fix ambiguous reference error for duplicate model names across packages with tests (#8488)

* Safely remove external nodes from manifest (#8495)

* [CT-2840] Improved semantic layer protocol satisfaction tests (#8456)

* Test `SemanticModel` satisfies protocol when none of it's `Optionals` are specified

* Add tests ensuring SourceFileMetadata and FileSlice satisfiy DSI protocols

* Add test asserting Defaults obj satisfies protocol

* Add test asserting SemanticModel with optionals specified satisfies protocol

* Split dimension protocol satisfaction tests into with and without optionals

* Simplify DSI Protocol import strategy in protocol satisfaction tests

* Add test asserting DimensionValidtyParams satisfies protocol

* Add test asserting DimensionTypeParams satisfies protocol

* Split entity protocol satisfaction tests into with and without optionals

* Split measure protocol satisfication tests and add measure aggregation params satisficaition test

* Split metric protocol satisfaction test into optional specified an unspecified

Additionally, create where_filter pytest fixture

* Improve protocol satisfaction tests for MetricTypeParams and sub protocols

Specifically we added/improved protocol satisfaction tests for
- MetricTypeParams
- MetricInput
- MetricInputMeasure
- MetricTimeWindow

* Convert to using mashumaro jsonschema with acceptable performance (#8437)

* Regenerate run_results schema after merging in changes from main.

---------

Co-authored-by: Gerda Shank <gerda@dbtlabs.com>
Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Quigley Malcolm <QMalcolm@users.noreply.github.com>
Co-authored-by: dave-connors-3 <73915542+dave-connors-3@users.noreply.github.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
Co-authored-by: Jaime Martínez Rincón <jaime@jamezrin.name>
Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com>
2023-08-30 17:28:49 -04:00
Gerda Shank
f063e4e01c Convert to using mashumaro jsonschema with acceptable performance (#8437) 2023-08-30 14:06:59 -04:00
Quigley Malcolm
07372db906 [CT-2840] Improved semantic layer protocol satisfaction tests (#8456)
* Test `SemanticModel` satisfies protocol when none of it's `Optionals` are specified

* Add tests ensuring SourceFileMetadata and FileSlice satisfiy DSI protocols

* Add test asserting Defaults obj satisfies protocol

* Add test asserting SemanticModel with optionals specified satisfies protocol

* Split dimension protocol satisfaction tests into with and without optionals

* Simplify DSI Protocol import strategy in protocol satisfaction tests

* Add test asserting DimensionValidtyParams satisfies protocol

* Add test asserting DimensionTypeParams satisfies protocol

* Split entity protocol satisfaction tests into with and without optionals

* Split measure protocol satisfication tests and add measure aggregation params satisficaition test

* Split metric protocol satisfaction test into optional specified an unspecified

Additionally, create where_filter pytest fixture

* Improve protocol satisfaction tests for MetricTypeParams and sub protocols

Specifically we added/improved protocol satisfaction tests for
- MetricTypeParams
- MetricInput
- MetricInputMeasure
- MetricTimeWindow
2023-08-29 09:40:30 -07:00
Michelle Ark
48d04e8141 Safely remove external nodes from manifest (#8495) 2023-08-28 14:10:34 -04:00
Michelle Ark
6234267242 Fix ambiguous reference error for duplicate model names across packages with tests (#8488) 2023-08-25 09:15:07 -04:00
Emily Rockman
1afbb87e99 Convert error to conditional warning for unversioned contracted model, fix msg format (#8451)
* first pass, tests need updates

* update proto defn

* fixing tests

* more test fixes

* finish fixing test file

* reformat the message

* formatting messages

* changelog

* add event to unit test

* feedback on message structure

* WIP

* fix up event to take in all fields

* fix test
2023-08-24 19:29:31 -05:00
Mike Alfare
d18a74ddb7 updated typing and methods to meet mypy standards (#8485) 2023-08-24 16:25:42 -04:00
Michelle Ark
4d3c6d9c7c revert update agate for int (#8478) 2023-08-23 14:06:52 -04:00
Emily Rockman
10f9724827 Split tests into classes (#8474)
* add flaky decorator

* split up tests into classes
2023-08-23 11:27:34 -05:00
Emily Rockman
582faa129e update the implementation template (#8466)
* update the implementation template

* add colon
2023-08-22 13:58:25 -05:00
Emily Rockman
4ec87a01e0 swap trigger (#8463) 2023-08-21 15:48:37 -05:00
Mike Alfare
ff98685dd6 ADAP-814: Refactor prep for MV updates (#8459)
* apply reformatting changes only for #8449
* add logging back to get_create_materialized_view_as_sql
* changie
2023-08-21 14:44:47 -04:00
Jaime Martínez Rincón
424f3d218a Improve docker image README (#8212)
* Improve docker image README

- Fix unnecessary/missing newline escapes
- Remove double whitespace between parameters
- 2-space indent for extra lines in image build commands

* Add changelog entry for #8212
2023-08-18 14:14:59 -05:00
dave-connors-3
661623f9f7 update Number class to handle integer values (#8306)
* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2023-08-18 14:01:08 -05:00
Quigley Malcolm
49397b4d7b [CT-3013] Fix parsing of window_groupings (#8454)
* Update semantic model parsing tests to check measure non_additive_dimension spec

* Make `window_groupings` default to empty list if not specified on `non_additive_dimension`

* Add changie doc for `window_groupings`  parsing fix
2023-08-18 10:57:29 -07:00
FishtownBuildBot
0553fd817c [Automated] Merged prep-release/1.7.0b1_5895067219 into target main during release process 2023-08-17 15:04:21 -05:00
Github Build Bot
7ad971f720 Bumping version to 1.7.0b1 and generate changelog 2023-08-17 19:25:44 +00:00
Matthew McKnight
f485c13035 revert python version for docker images (#8445)
* revert python version for docker images

* add comment to not update python version, update changelog
2023-08-17 14:18:28 -05:00
Gerda Shank
c30b691164 Fix mypy warnings for ManifestLoader.load() (#8443) 2023-08-17 14:34:22 -04:00
Quigley Malcolm
d088d4493e Add doc string context to Identifier validion regex rule (#8440) 2023-08-17 10:11:03 -07:00
Emily Rockman
770f804325 Fix test failures (#8432)
* fail job when anything fails in previous matrix

* tweak wording

* PR feedback
2023-08-17 07:20:07 -05:00
Emily Rockman
37a29073de change trigger (#8418) 2023-08-16 19:49:59 -05:00
Peter Webb
17cd145f09 Temporarily disable test. (#8434) 2023-08-16 16:42:48 -04:00
Kshitij Aranke
ac539fd5cf Ignore .github and .changes directories for code coverage (#8424)
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2023-08-16 16:19:12 +01:00
Gerda Shank
048553ddc3 Fix using project-dir with list command and path selector (#8388) 2023-08-16 10:39:22 -04:00
Gerda Shank
dfe6b71fd9 Add return values to functions to fix mypy warnings (#8416) 2023-08-16 10:37:46 -04:00
Peter Webb
18ee93ca3a Fix run_results.json Performance Regression (#8413)
* Remedy performance regression by only writing run_results.json once.

* Write results before cleaning up connections.
2023-08-15 16:41:14 -04:00
Emily Rockman
cb4bc2d6e9 Automate opening docs issues (#8373)
* first pass

* WIP

* update issue body

* fix triggering label

* fix docs

* add better run name

* reduce complexity

* update description

* fix PR title

* point at workflow on main

* fix wording

* add label
2023-08-15 14:20:46 -05:00
Quigley Malcolm
b0451806ef [CT-2526] Add ability to automatically create metrics from semantic model measures (#8310)
* Update semantic model parsing test to check `create_metric = true` functionality

* Add `create_metric` boolean property to unparsed measure objects

* Begin creating metrics from measures with `create_metric = True`

* Add test ensuring partial parsing handles metrics generated from measures

* Ensure partial parsing appropriately deletes metrics generated from semantic models

* Add changie doc for  addition

* Separate generated metrics from parsed metrics for partial parsing

I was doing a demo earlier today of this branch (minus this commit)
and noticed something odd. When I changes a semantic model, metrics
that should have been technically uneffected would get dropped. Basically
if I made a change to a semantic model which had metrics in the same
file, and then ran parse, those metrics defined in the same file
would get dropped. Then with no other changes, if I ran parse again
they would come back. What was happening was that parsed metrics
and generated metrics were getting tracked the same way on the file
objects for partial parsing. In 0787a7c7b6
we began dropping all metrics tracked in a file objects when changes
to semantic models were detected. Since parsed metrics and generated
metrics were being tracked together on the file object, the parsed
metrics were getting dropped as well. In this commit we begin separating
out the tracking of generated metrics and parsed metrics on the
file object, and now only drop the generated metrics when semantic
models have a detected change.

* Assert in test that  semantic model partial parsing doesn't clobber regular metrics
2023-08-14 12:42:11 -07:00
Kshitij Aranke
b514e4c249 Fix #8350: add connection status into list of statuses for dbt debug (#8351) 2023-08-14 18:13:10 +01:00
Michelle Ark
8350dfead3 add --no-partial-parse-file-diff flag (#8361)
* add --no-partial-parse-file-diff flag

* changelog entry
2023-08-14 13:24:16 +02:00
Michelle Ark
34e6edbb13 Fix: deleting models that depend on external nodes (#8330) 2023-08-14 10:31:58 +02:00
FishtownBuildBot
27be92903e Add new index.html and changelog yaml files from dbt-docs (#8346) 2023-08-14 13:12:37 +08:00
Michelle Ark
9388030182 fix ModelNodeArgs.fqn (#8364) 2023-08-11 23:21:44 -04:00
Emily Rockman
b7aee3f5a4 add env vars to tox.ini (#8365)
* add env vars to tox.ini

* revert test
2023-08-11 10:49:41 -05:00
Michelle Ark
83ff38ab24 track plugin.get_nodes (#8336) 2023-08-10 11:33:11 -04:00
Michelle Ark
6603a44151 Detect changes to model access, deprecation_date, and latest_version in state:modified (#8264) 2023-08-10 11:29:02 -04:00
Kshitij Aranke
e69d4e7f14 Fix #8245: Add flag to codecov report (#8341) 2023-08-09 18:14:52 +01:00
d-kaneshiro
506f65e880 fixed comment util.py (#8222)
* fixed comments util.py

* add CHANGELOG entries
2023-08-09 09:24:38 -04:00
Gerda Shank
41bb52762b Bump manifest jsonschema to v11, update v10 schema (#8335) 2023-08-08 22:55:47 -04:00
Anju
8c98ef3e70 Copy dir if symlink fails (#7447) 2023-08-08 21:37:36 -04:00
Emily Rockman
44d1e73b4f Fix missing quote in fixtures.py (#8324) 2023-08-07 15:46:44 -05:00
Emily Rockman
53794fbaba Update implementation-ticket.yml (#8332) 2023-08-07 14:09:37 -06:00
Emily Rockman
556b4043e9 Update implementation-ticket.yml to reference adapters (#8329) 2023-08-07 12:39:29 -05:00
Grant Murray
424c636533 [CT-2776] [Feature] Enable-post-parse-population-of-dbt-custom-env (#7998)
* patch(events/functions): enable-repopulation-of-metadata-vars

* changie new
2023-08-04 12:59:47 -07:00
Emily Rockman
f63709260e add formatting events into json logs (#8308)
* add formatting events into json logs

* changelog

* Delete Under the Hood-20230803-100811.yaml
2023-08-03 15:56:01 -05:00
Michelle Ark
991618dfc1 capitalize integration-report name (#8265) 2023-08-02 18:06:05 -04:00
Chenyu Li
1af489b1cd fix constructing param with 0 value (#8298)
* fix constructing param with 0 value

* Update core/dbt/cli/flags.py

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

---------

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
2023-08-02 14:57:55 -07:00
Kshitij Aranke
a433c31d6e Fix #7179 (#8279) 2023-08-02 16:56:16 +01:00
Peter Webb
5814928e38 Issue One Event Per Node Failure (#8210)
* Replaced the FirstRunResultError and AfterFirstRunResultError events with RunResultError.

* Attempts at reasonable unit tests.

* Restore event manager after unit test.
2023-08-02 10:24:05 -04:00
Ramon Vermeulen
6130a6e1d0 Support configurable delimiter for seed files, default to comma (#3990) (#7186)
* Support configurable delimiter for seed files, default to comma (#3990)

* Update Features-20230317-144957.yaml

* Moved "delimiter" to seed config instead of node config

* Update core/dbt/clients/agate_helper.py

Co-authored-by: Cor <jczuurmond@protonmail.com>

* Update test_contracts_graph_parsed.py

* fixed integration tests

* Added functional tests for seed files with a unique delimiter

* Added docstrings

* Added a test for an empty string configured delimiter value

* whitespace

* ran black

* updated changie entry

* Update Features-20230317-144957.yaml

---------

Co-authored-by: Cor <jczuurmond@protonmail.com>
2023-08-01 09:15:43 -07:00
Quigley Malcolm
7872f6a670 Add tests for specifcally checking the population of SemanticModel.depends_on (#8226) 2023-07-31 14:15:09 -07:00
Emily Rockman
f230e418aa hard code test splits (#8258)
* change trigger

* add logic for different targets

* fix comment

* hard code test splits
2023-07-31 13:26:17 -05:00
Quigley Malcolm
518eb73f88 [CT-2888] Support dbt-semantic-interfaces 0.2.0 (#8250)
* Upgrade DSI dependency to ~=0.2.0

* Allow users to specify `primary_entity` on semantic models

* Add `primary_entity` and `primary_entity_reference` to SemanticModel node

* Plumb primary_entity from unparsed to parsed semantic nodes

* Fix metric filter specifications in existing tests

* Add changie doc about supporting DSI 0.2.0
2023-07-28 14:36:51 -07:00
Emily Rockman
5b6d21d7da loosen the click pin (#8232)
* loosen the click pin

* changelog

* separate out sqlparse pin

* remove changelog

* add ignores
2023-07-28 15:53:27 -05:00
Michelle Ark
410506f448 [Fix] raise execution errors for runnable tasks (#8237) 2023-07-28 13:18:51 -04:00
dependabot[bot]
3cb44d37c0 Bump mypy from 1.4.0 to 1.4.1 (#8219)
* Bump mypy from 1.4.0 to 1.4.1

Bumps [mypy](https://github.com/python/mypy) from 1.4.0 to 1.4.1.
- [Commits](https://github.com/python/mypy/compare/v1.4.0...v1.4.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

* update pre-commit

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2023-07-28 07:33:16 -05:00
Quigley Malcolm
f977ed7471 [CT-2879] Fix unbound variable error in checked_agg_time_dimension_for_measure (#8235)
* Fix unbound variable error in `checked_agg_time_dimension_for_measure`

* Improve assertion error message in `checked_agg_time_dimension_for_measure`

* Add changie doc for checked_agg_time_dimension_for_measure unbound variable fix

* Add unit tests for checking functionality of `checked_agg_time_dimension_for_measure`
2023-07-27 14:58:59 -07:00
Emily Rockman
3f5617b569 pin upper bound for sqlparse (#8236)
* pin upper bound for sqlparse

* changelog
2023-07-27 16:29:42 -05:00
Gerda Shank
fe9c875d32 Ensure that target_schema from snapshot config is promoted to node level (#8117) 2023-07-27 13:40:52 -04:00
Michelle Ark
23b16ad6d2 Split integration tests into parallel groups / jobs (#6346) 2023-07-27 11:27:34 -04:00
Gerda Shank
fdeccfaf24 Initialize sqlparse lexer and tweak order of setting compilation fields (#8215) 2023-07-26 17:29:51 -04:00
dependabot[bot]
fecde23da5 Bump mypy from 1.3.0 to 1.4.0 (#7912)
* Bump mypy from 1.3.0 to 1.4.0

Bumps [mypy](https://github.com/python/mypy) from 1.3.0 to 1.4.0.
- [Commits](https://github.com/python/mypy/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add automated changelog yaml from template for bot PR

* add to pre-commit config

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <buildbot@fishtownanalytics.com>
Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
2023-07-26 15:15:40 -05:00
Emily Rockman
b1d931337e up timeout (#8218) 2023-07-26 13:50:03 -05:00
Michelle Ark
39542336b8 Update implementation-ticket.yml (#8208) 2023-07-25 18:50:13 -04:00
Peter Webb
799588cada Update Core for Latest dbt-extractor with Version Parsing (#8206)
* Update dbt-extractor requirement, and adjust ref handling accordingly

* Add changelog entry.
2023-07-25 15:47:29 -04:00
Chenyu Li
f392add4b8 add param to control maxBytes for single dbt.log file (#8200)
* add param to control maxBytes for single dbt.log file

* nits

* nits

* Update core/dbt/cli/params.py

Co-authored-by: Peter Webb <peter.webb@dbtlabs.com>

---------

Co-authored-by: Peter Webb <peter.webb@dbtlabs.com>
2023-07-25 12:30:55 -07:00
Gerda Shank
49560bf2a2 Check for existing_relation immediately prior to renaming (#8193) 2023-07-25 12:59:18 -04:00
Quigley Malcolm
44b3ed5ae9 [CT-2594] Fix serialization of warn_error_options on Contexts (#8180)
* Add test ensuring `warn_error_options` is dictified in `invocation_args_dict` of contexts

* Add dictification specific to `warn_error_options` in `args_to_dict`

* Changie doc for serialization changes of warn_error_options
2023-07-24 13:35:27 -07:00
Quigley Malcolm
6235145641 [CT-1483] Let macro names include word materialization (#8181)
* Add test asserting that a macro with the work materializtion doesn't cause issues

* Let macro names include the word `materialization`

Previously we were checking if a macro included a materialization
based on if the macro name included the word `materialization`. However,
a macro name included the word `materialization` isn't guarnteed to
actually have a materialization, and a macro that doesn't have
`materialization` in the name isn't guaranteed to not have a materialization.
This change is to detect macros with materializations based on the
detected block type of the macro.

* Add changie doc materialization in macro detection
2023-07-24 13:10:42 -07:00
lllong33
ff5cb7ba51 Fixed double underline (#7944)
* Fixed double-underline
* backward compatibility postgres_get_relations
* Remove invalid comments
* compatibility adapter and get_relation
* fix generic for call
* fix adapter dispatch grammar issue
2023-07-21 17:28:27 -04:00
Quigley Malcolm
1e2b9ae962 [CT-1849] _connection_exception_retry handles EOFError exceptions (#8182)
* Add test for checking that `_connection_exception_retry` handles `EOFError`s

* Update `_connection_exception_retry` to handle `EOFError` exceptions

* Add changie docs for `_connection_exception_retry` handling `EOFError` exceptions
2023-07-21 11:34:06 -07:00
Michelle Ark
8cab58d248 Add implementation issue template (#8176) 2023-07-21 13:50:53 -04:00
Chenyu Li
0d645c227f add a node status (#8174) 2023-07-20 14:38:01 -07:00
Pádraic Slattery
fb6c349677 Correcting spelling of partition (#8101)
* Correcting spelling of partition

* Changie entry
2023-07-20 11:05:11 -07:00
Kshitij Aranke
eeb057085c Hotfix for 372: Use JSONEncoder in json.dumps (#8151) 2023-07-19 18:32:47 -05:00
Michelle Ark
121371f4a4 format exception from dbtPlugin.initialize (#8143) 2023-07-19 17:39:26 -04:00
Gerda Shank
a32713198b Rearrange pp_versioned_models test (#8150) 2023-07-19 17:05:09 -04:00
Jeremy Cohen
a1b067c683 Rm docs changelog entry (#8147) 2023-07-19 12:53:14 +02:00
leahwicz
22c40a4766 Update release-docker.yml 2023-05-03 09:33:31 -04:00
leahwicz
bcf140b3c1 Update release-docker.yml 2023-05-02 23:21:08 -04:00
leahwicz
e3692a6a3d Update release.yml 2023-05-02 23:11:40 -04:00
leahwicz
e7489383a2 Update release-docker.yml 2023-05-02 23:11:27 -04:00
leahwicz
70246c3f86 Update release.yml 2023-05-02 22:50:35 -04:00
leahwicz
0796c84da5 Update release-docker.yml 2023-05-02 22:50:18 -04:00
leahwicz
718482fb02 Update release.yml 2023-05-02 22:46:13 -04:00
leahwicz
a3fb66daa4 Update release-docker.yml 2023-05-02 22:45:41 -04:00
leahwicz
da34b80c26 Update release-docker.yml 2023-05-02 22:43:59 -04:00
leahwicz
ba5ab21140 Update release-docker.yml 2023-05-02 22:27:57 -04:00
leahwicz
65f41a1e36 Update testing.yml 2023-05-02 22:12:39 -04:00
leahwicz
0930c9c059 Update release.yml 2023-05-02 22:08:11 -04:00
leahwicz
1d193a9ab9 Update release-docker.yml 2023-05-02 22:07:53 -04:00
leahwicz
3adc6dca61 Update release-docker.yml 2023-05-02 22:03:15 -04:00
leahwicz
36d9f841d6 Update release-docker.yml 2023-05-02 22:01:27 -04:00
leahwicz
48ad13de00 Update release.yml 2023-05-02 21:57:19 -04:00
leahwicz
42935cce05 Update release.yml 2023-05-02 21:52:56 -04:00
leahwicz
e77f1c3b0f Update release.yml 2023-05-02 19:24:59 -04:00
leahwicz
388838aa99 Update testing.yml 2023-05-02 19:20:06 -04:00
leahwicz
d4d0990072 Update release.yml 2023-05-02 19:04:40 -04:00
leahwicz
4210d17f14 Update testing.yml 2023-05-02 19:03:15 -04:00
leahwicz
fbd12e78c9 Update testing.yml 2023-05-02 18:40:41 -04:00
leahwicz
83d3421e72 Update testing.yml 2023-05-02 17:55:56 -04:00
leahwicz
8bcbf73aaa Update release-docker.yml 2023-05-02 17:31:20 -04:00
leahwicz
cc5f15885d Update release.yml 2023-05-02 17:29:33 -04:00
leahwicz
20fdf55bf6 Update testing.yml 2023-05-02 17:15:07 -04:00
leahwicz
955dcec68b Update testing.yml 2023-05-02 17:03:23 -04:00
leahwicz
2b8564b16f Update testing.yml 2023-05-02 16:55:21 -04:00
leahwicz
57da3e51cd Update testing.yml 2023-05-02 13:14:50 -04:00
leahwicz
dede0e9747 Update testing.yml 2023-05-02 13:11:57 -04:00
leahwicz
35d2fc1158 Update testing.yml 2023-05-02 13:10:04 -04:00
leahwicz
c5267335a3 Update testing.yml 2023-05-02 13:08:00 -04:00
leahwicz
15c7b589c2 Update testing.yml 2023-05-02 13:06:35 -04:00
leahwicz
0ada5e8bf7 Create testing.yml 2023-05-02 12:17:26 -04:00
leahwicz
412ac8d1b9 Update release.yml 2023-04-19 09:08:39 -04:00
leahwicz
5df501a281 Update release.yml 2023-04-18 21:48:49 -04:00
leahwicz
3e4c61d020 Update release.yml 2023-04-18 21:46:26 -04:00
leahwicz
cc39fe51b3 Update release-docker.yml 2023-04-18 21:44:08 -04:00
leahwicz
89cd24388d Update release.yml 2023-04-18 21:40:55 -04:00
leahwicz
d5da0a8093 Update release.yml 2023-04-18 21:36:29 -04:00
leahwicz
88ae1f8871 Update release-docker.yml 2023-04-18 09:15:19 -04:00
leahwicz
50b3d1deaa Update release-docker.yml 2023-04-17 21:22:55 -04:00
leahwicz
3b3def5b8a Update release-docker.yml 2023-04-17 21:11:34 -04:00
leahwicz
4f068a45ff Update release-docker.yml 2023-04-17 21:06:40 -04:00
leahwicz
23a9504a51 Update release-docker.yml 2023-04-17 21:03:29 -04:00
leahwicz
d0d4eba477 Update release-docker.yml 2023-04-17 21:02:10 -04:00
leahwicz
a3fab0b5a9 Update release-docker.yml 2023-04-17 20:57:20 -04:00
1191 changed files with 101837 additions and 40886 deletions

View File

@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.7.0a1
current_version = 1.10.0b2
parse = (?P<major>[\d]+) # major version number
\.(?P<minor>[\d]+) # minor version number
\.(?P<patch>[\d]+) # patch version number
@@ -35,13 +35,3 @@ first_value = 1
[bumpversion:file:core/setup.py]
[bumpversion:file:core/dbt/version.py]
[bumpversion:file:plugins/postgres/setup.py]
[bumpversion:file:plugins/postgres/dbt/adapters/postgres/__version__.py]
[bumpversion:file:docker/Dockerfile]
[bumpversion:file:tests/adapter/setup.py]
[bumpversion:file:tests/adapter/dbt/tests/adapter/__version__.py]

View File

@@ -3,6 +3,7 @@
For information on prior major and minor releases, see their changelogs:
* [1.7](https://github.com/dbt-labs/dbt-core/blob/1.7.latest/CHANGELOG.md)
* [1.6](https://github.com/dbt-labs/dbt-core/blob/1.6.latest/CHANGELOG.md)
* [1.5](https://github.com/dbt-labs/dbt-core/blob/1.5.latest/CHANGELOG.md)
* [1.4](https://github.com/dbt-labs/dbt-core/blob/1.4.latest/CHANGELOG.md)

72
.changes/1.10.0-b1.md Normal file
View File

@@ -0,0 +1,72 @@
## dbt-core 1.10.0-b1 - March 12, 2025
### Breaking Changes
- Add invocations_started_at field to artifact metadata ([#11272](https://github.com/dbt-labs/dbt-core/issues/11272))
### Features
- Add new hard_deletes="new_record" mode for snapshots. ([#10235](https://github.com/dbt-labs/dbt-core/issues/10235))
- Add `batch` context object to model jinja context ([#11025](https://github.com/dbt-labs/dbt-core/issues/11025))
- Ensure pre/post hooks only run on first/last batch respectively for microbatch model batches ([#11094](https://github.com/dbt-labs/dbt-core/issues/11094), [#11104](https://github.com/dbt-labs/dbt-core/issues/11104))
- Support "tags" in Saved Queries ([#11155](https://github.com/dbt-labs/dbt-core/issues/11155))
- Calculate source freshness via a SQL query ([#8797](https://github.com/dbt-labs/dbt-core/issues/8797))
- Add freshness definition on model for adaptive job ([#11123](https://github.com/dbt-labs/dbt-core/issues/11123))
- Meta config for dimensions measures and entities ([#None](https://github.com/dbt-labs/dbt-core/issues/None))
- Add doc_blocks to manifest for nodes and columns ([#11000](https://github.com/dbt-labs/dbt-core/issues/11000), [#11001](https://github.com/dbt-labs/dbt-core/issues/11001))
- Initial implementation of sample mode ([#11227](https://github.com/dbt-labs/dbt-core/issues/11227), [#11230](https://github.com/dbt-labs/dbt-core/issues/11230), [#11231](https://github.com/dbt-labs/dbt-core/issues/11231), [#11248](https://github.com/dbt-labs/dbt-core/issues/11248), [#11252](https://github.com/dbt-labs/dbt-core/issues/11252), [#11254](https://github.com/dbt-labs/dbt-core/issues/11254), [#11258](https://github.com/dbt-labs/dbt-core/issues/11258))
- Combine `--sample` and `--sample-window` CLI params ([#11299](https://github.com/dbt-labs/dbt-core/issues/11299))
- Allow for sampling of ref'd seeds ([#11300](https://github.com/dbt-labs/dbt-core/issues/11300))
- Enable sample mode for 'build' command ([#11298](https://github.com/dbt-labs/dbt-core/issues/11298))
- Allow sampling nodes snapshots depend on and of snapshots as a dependency ([#11301](https://github.com/dbt-labs/dbt-core/issues/11301))
### Fixes
- dbt retry does not respect --threads ([#10584](https://github.com/dbt-labs/dbt-core/issues/10584))
- update adapter version messages ([#10230](https://github.com/dbt-labs/dbt-core/issues/10230))
- Catch DbtRuntimeError for hooks ([#11012](https://github.com/dbt-labs/dbt-core/issues/11012))
- Access DBUG flag more consistently with the rest of the codebase in ManifestLoader ([#11068](https://github.com/dbt-labs/dbt-core/issues/11068))
- Improve the performance characteristics of add_test_edges() ([#10950](https://github.com/dbt-labs/dbt-core/issues/10950))
- Implement partial parsing for singular data test configs in yaml files ([#10801](https://github.com/dbt-labs/dbt-core/issues/10801))
- Fix debug log messages for microbatch batch execution information ([#11111](https://github.com/dbt-labs/dbt-core/issues/11111))
- Fix running of extra "last" batch when there is only one batch ([#11112](https://github.com/dbt-labs/dbt-core/issues/11112))
- Fix interpretation of `PartialSuccess` to result in non-zero exit code ([#11114](https://github.com/dbt-labs/dbt-core/issues/11114))
- Warn about invalid usages of `concurrent_batches` config ([#11122](https://github.com/dbt-labs/dbt-core/issues/11122))
- Error writing generic test at run time ([#11110](https://github.com/dbt-labs/dbt-core/issues/11110))
- Run check_modified_contract for state:modified ([#11034](https://github.com/dbt-labs/dbt-core/issues/11034))
- Fix unrendered_config for tests from dbt_project.yml ([#11146](https://github.com/dbt-labs/dbt-core/issues/11146))
- Make partial parsing reparse referencing nodes of newly versioned models. ([#8872](https://github.com/dbt-labs/dbt-core/issues/8872))
- Ensure warning about microbatch lacking filter inputs is always fired ([#11159](https://github.com/dbt-labs/dbt-core/issues/11159))
- Fix microbatch dbt list --output json ([#10556](https://github.com/dbt-labs/dbt-core/issues/10556), [#11098](https://github.com/dbt-labs/dbt-core/issues/11098))
- Fix for custom fields in generic test config for not_null and unique tests ([#11208](https://github.com/dbt-labs/dbt-core/issues/11208))
- Loosen validation on freshness to accomodate previously wrong but harmless config. ([#11123](https://github.com/dbt-labs/dbt-core/issues/11123))
- Handle `--limit -1` properly in `ShowTaskDirect` so that it propagates None instead of a negative int ([#None](https://github.com/dbt-labs/dbt-core/issues/None))
- _get_doc_blocks is crashing parsing if .format is called ([#11310](https://github.com/dbt-labs/dbt-core/issues/11310))
- Fix microbatch execution to not block main thread nor hang ([#11243](https://github.com/dbt-labs/dbt-core/issues/11243), [#11306](https://github.com/dbt-labs/dbt-core/issues/11306))
- Fixes parsing errors when using the new YAML format for snapshots ([#11164](https://github.com/dbt-labs/dbt-core/issues/11164))
### Under the Hood
- Create a no-op exposure runner ([#](https://github.com/dbt-labs/dbt-core/issues/), [#](https://github.com/dbt-labs/dbt-core/issues/))
- Improve selection peformance by optimizing the select_children() and select_parents() functions. ([#11099](https://github.com/dbt-labs/dbt-core/issues/11099))
- Change exception type from DbtInternalException to UndefinedMacroError when macro not found in 'run operation' command ([#11192](https://github.com/dbt-labs/dbt-core/issues/11192))
- Create LogNodeResult event ([#](https://github.com/dbt-labs/dbt-core/issues/), [#](https://github.com/dbt-labs/dbt-core/issues/))
- Fix error counts for exposures ([#](https://github.com/dbt-labs/dbt-core/issues/), [#](https://github.com/dbt-labs/dbt-core/issues/))
- Misc fixes for group info in logging ([#11218](https://github.com/dbt-labs/dbt-core/issues/11218))
- Add secondary profiles to profile.py ([#XPLAT-241](https://github.com/dbt-labs/dbt-core/issues/XPLAT-241))
### Dependencies
- Upgrading dbt-semantic-interfaces to 0.8.3 for custom grain support in offset windows ([#None](https://github.com/dbt-labs/dbt-core/issues/None))
- Bump codecov/codecov-action from 4 to 5 ([#11009](https://github.com/dbt-labs/dbt-core/issues/11009))
### Contributors
- [@DevonFulcher](https://github.com/DevonFulcher) ([#None](https://github.com/dbt-labs/dbt-core/issues/None))
- [@Threynaud](https://github.com/Threynaud) ([#11068](https://github.com/dbt-labs/dbt-core/issues/11068))
- [@WilliamDee](https://github.com/WilliamDee) ([#None](https://github.com/dbt-labs/dbt-core/issues/None), [#None](https://github.com/dbt-labs/dbt-core/issues/None))
- [@amardatar](https://github.com/amardatar) ([#11164](https://github.com/dbt-labs/dbt-core/issues/11164))
- [@d-cole](https://github.com/d-cole) ([#8872](https://github.com/dbt-labs/dbt-core/issues/8872))
- [@dave-connors-3](https://github.com/dave-connors-3) ([#10230](https://github.com/dbt-labs/dbt-core/issues/10230))
- [@donjin-master](https://github.com/donjin-master) ([#10584](https://github.com/dbt-labs/dbt-core/issues/10584))
- [@internetcoffeephone](https://github.com/internetcoffeephone) ([#10556](https://github.com/dbt-labs/dbt-core/issues/10556), [#11098](https://github.com/dbt-labs/dbt-core/issues/11098))
- [@theyostalservice](https://github.com/theyostalservice) ([#11155](https://github.com/dbt-labs/dbt-core/issues/11155))

20
.changes/1.10.0-b2.md Normal file
View File

@@ -0,0 +1,20 @@
## dbt-core 1.10.0-b2 - April 02, 2025
### Features
- Add opt-in validation of macro argument names and types ([#11274](https://github.com/dbt-labs/dbt-core/issues/11274))
- Add support for Python 3.13! ([#11401](https://github.com/dbt-labs/dbt-core/issues/11401))
- Support artifact upload to dbt Cloud ([#11418](https://github.com/dbt-labs/dbt-core/issues/11418))
### Fixes
- Update ConfigFolderDirectory dir to use str. ([#9768](https://github.com/dbt-labs/dbt-core/issues/9768), [#11305](https://github.com/dbt-labs/dbt-core/issues/11305))
- Fix microbatch models couting as success when only having one batch (and that batch failing) ([#11390](https://github.com/dbt-labs/dbt-core/issues/11390))
### Under the Hood
- Add node_checksum to node_info on structured logs ([#11372](https://github.com/dbt-labs/dbt-core/issues/11372))
- Parse catalogs.yml ([#XPLAT-242](https://github.com/dbt-labs/dbt-core/issues/XPLAT-242))
### Contributors
- [@thorn14](https://github.com/thorn14) ([#9768](https://github.com/dbt-labs/dbt-core/issues/9768), [#11305](https://github.com/dbt-labs/dbt-core/issues/11305))

View File

@@ -0,0 +1,6 @@
kind: Breaking Changes
body: Add invocations_started_at field to artifact metadata
time: 2025-02-10T12:33:06.722803-05:00
custom:
Author: gshank
Issue: "11272"

View File

@@ -0,0 +1,6 @@
kind: Dependencies
body: Upgrading dbt-semantic-interfaces to 0.8.3 for custom grain support in offset windows
time: 2024-11-12T16:38:15.351519-05:00
custom:
Author: WilliamDee
Issue: None

View File

@@ -0,0 +1,6 @@
kind: "Dependencies"
body: "Bump codecov/codecov-action from 4 to 5"
time: 2024-11-18T00:11:13.00000Z
custom:
Author: dependabot[bot]
Issue: 11009

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add new hard_deletes="new_record" mode for snapshots.
time: 2024-11-04T12:00:53.95191-05:00
custom:
Author: peterallenwebb
Issue: "10235"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add `batch` context object to model jinja context
time: 2024-11-21T12:56:30.715473-06:00
custom:
Author: QMalcolm
Issue: "11025"

View File

@@ -0,0 +1,7 @@
kind: Features
body: Ensure pre/post hooks only run on first/last batch respectively for microbatch
model batches
time: 2024-12-06T19:53:08.928793-06:00
custom:
Author: MichelleArk QMalcolm
Issue: 11094 11104

View File

@@ -0,0 +1,6 @@
kind: Features
body: Support "tags" in Saved Queries
time: 2024-12-16T09:54:35.327675-08:00
custom:
Author: theyostalservice
Issue: "11155"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Calculate source freshness via a SQL query
time: 2024-12-17T17:16:31.841076-08:00
custom:
Author: ChenyuLInx
Issue: "8797"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add freshness definition on model for adaptive job
time: 2024-12-18T17:07:29.55754-08:00
custom:
Author: ChenyuLInx
Issue: "11123"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Meta config for dimensions measures and entities
time: 2025-01-06T13:28:29.176439-06:00
custom:
Author: DevonFulcher
Issue: None

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add doc_blocks to manifest for nodes and columns
time: 2025-01-22T17:03:28.866522Z
custom:
Author: aranke
Issue: 11000 11001

View File

@@ -0,0 +1,6 @@
kind: Features
body: Initial implementation of sample mode
time: 2025-02-02T14:00:54.074209-06:00
custom:
Author: QMalcolm
Issue: 11227 11230 11231 11248 11252 11254 11258

View File

@@ -0,0 +1,6 @@
kind: Features
body: Combine `--sample` and `--sample-window` CLI params
time: 2025-02-12T15:56:58.546879-06:00
custom:
Author: QMalcolm
Issue: "11299"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Allow for sampling of ref'd seeds
time: 2025-02-12T17:37:43.554156-06:00
custom:
Author: QMalcolm
Issue: "11300"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Enable sample mode for 'build' command
time: 2025-02-13T18:29:32.238857-06:00
custom:
Author: QMalcolm
Issue: "11298"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Allow sampling nodes snapshots depend on and of snapshots as a dependency
time: 2025-02-14T15:29:57.118017-06:00
custom:
Author: QMalcolm
Issue: "11301"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add opt-in validation of macro argument names and types
time: 2025-03-14T14:31:57.463865-04:00
custom:
Author: peterallenwebb
Issue: "11274"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add support for Python 3.13!
time: 2025-03-19T15:33:56.641753-04:00
custom:
Author: peterallenwebb
Issue: "11401"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Support artifact upload to dbt Cloud
time: 2025-03-23T15:16:25.160263-07:00
custom:
Author: ChenyuLInx
Issue: "11418"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: dbt retry does not respect --threads
time: 2024-08-22T12:21:32.358066+05:30
custom:
Author: donjin-master
Issue: "10584"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: update adapter version messages
time: 2024-10-25T10:43:39.274723-05:00
custom:
Author: dave-connors-3
Issue: "10230"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Catch DbtRuntimeError for hooks
time: 2024-11-21T18:17:39.753235Z
custom:
Author: aranke
Issue: "11012"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Access DBUG flag more consistently with the rest of the codebase in ManifestLoader
time: 2024-11-28T16:29:36.236729+01:00
custom:
Author: Threynaud
Issue: "11068"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Improve the performance characteristics of add_test_edges()
time: 2024-12-04T10:04:29.096231-05:00
custom:
Author: peterallenwebb
Issue: "10950"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Implement partial parsing for singular data test configs in yaml files
time: 2024-12-05T14:53:07.295536-05:00
custom:
Author: gshank
Issue: "10801"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix debug log messages for microbatch batch execution information
time: 2024-12-09T11:38:06.972743-06:00
custom:
Author: MichelleArk QMalcolm
Issue: "11111"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix running of extra "last" batch when there is only one batch
time: 2024-12-09T13:33:17.253326-06:00
custom:
Author: QMalcolm
Issue: "11112"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix interpretation of `PartialSuccess` to result in non-zero exit code
time: 2024-12-09T15:07:11.391313-06:00
custom:
Author: QMalcolm
Issue: "11114"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Warn about invalid usages of `concurrent_batches` config
time: 2024-12-12T11:36:11.451962-06:00
custom:
Author: QMalcolm
Issue: "11122"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Error writing generic test at run time
time: 2024-12-16T13:46:45.936573-05:00
custom:
Author: gshank
Issue: "11110"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Run check_modified_contract for state:modified
time: 2024-12-17T15:48:48.053054-05:00
custom:
Author: gshank
Issue: "11034"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix unrendered_config for tests from dbt_project.yml
time: 2024-12-18T11:26:40.270022-05:00
custom:
Author: gshank
Issue: "11146"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Make partial parsing reparse referencing nodes of newly versioned models.
time: 2025-01-02T14:05:43.629959-05:00
custom:
Author: d-cole
Issue: "8872"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Ensure warning about microbatch lacking filter inputs is always fired
time: 2025-01-07T17:37:19.373261-06:00
custom:
Author: QMalcolm
Issue: "11159"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix microbatch dbt list --output json
time: 2025-01-09T12:33:09.958795+01:00
custom:
Author: internetcoffeephone
Issue: 10556 11098

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix for custom fields in generic test config for not_null and unique tests
time: 2025-01-10T15:58:24.479245-05:00
custom:
Author: gshank
Issue: "11208"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Loosen validation on freshness to accomodate previously wrong but harmless config.
time: 2025-01-28T13:55:09.318833-08:00
custom:
Author: ChenyuLInx peterallenwebb
Issue: "11123"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Handle `--limit -1` properly in `ShowTaskDirect` so that it propagates None instead of a negative int
time: 2025-02-07T13:14:24.725503-05:00
custom:
Author: WilliamDee
Issue: None

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: _get_doc_blocks is crashing parsing if .format is called
time: 2025-02-18T13:47:45.659731Z
custom:
Author: aranke
Issue: "11310"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix microbatch execution to not block main thread nor hang
time: 2025-03-03T13:14:40.432874-06:00
custom:
Author: QMalcolm
Issue: 11243 11306

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fixes parsing errors when using the new YAML format for snapshots
time: 2025-03-05T11:02:57.829685Z
custom:
Author: amardatar
Issue: "11164"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Update ConfigFolderDirectory dir to use str.
time: 2025-03-26T19:42:59.335179-07:00
custom:
Author: thorn14 dbeatty10
Issue: 9768 11305

View File

@@ -0,0 +1,7 @@
kind: Fixes
body: Fix microbatch models couting as success when only having one batch (and that
batch failing)
time: 2025-03-28T17:01:42.342741-05:00
custom:
Author: QMalcolm
Issue: "11390"

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Create a no-op exposure runner
time: 2024-12-02T16:47:15.766574Z
custom:
Author: aranke
Issue: ' '

View File

@@ -0,0 +1,7 @@
kind: Under the Hood
body: Improve selection peformance by optimizing the select_children() and select_parents()
functions.
time: 2024-12-05T14:31:44.584216-05:00
custom:
Author: peterallenwebb
Issue: "11099"

View File

@@ -0,0 +1,7 @@
kind: Under the Hood
body: Change exception type from DbtInternalException to UndefinedMacroError when
macro not found in 'run operation' command
time: 2025-01-07T12:39:55.234321-05:00
custom:
Author: michelleark
Issue: "11192"

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Create LogNodeResult event
time: 2025-01-07T20:58:38.821036Z
custom:
Author: aranke
Issue: ' '

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Fix error counts for exposures
time: 2025-01-10T20:20:57.01632Z
custom:
Author: aranke
Issue: ' '

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Misc fixes for group info in logging
time: 2025-01-17T15:22:15.497485Z
custom:
Author: aranke
Issue: '11218'

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Add node_checksum to node_info on structured logs
time: 2025-03-07T10:17:58.375007-05:00
custom:
Author: michelleark
Issue: "11372"

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Parse catalogs.yml
time: 2025-03-21T15:50:26.845279Z
custom:
Author: MichelleArk aranke
Issue: XPLAT-242

View File

@@ -1,6 +1,6 @@
# dbt Core Changelog
- This file provides a full account of all changes to `dbt-core` and `dbt-postgres`
- This file provides a full account of all changes to `dbt-core`
- 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.
- 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)

View File

@@ -1,6 +0,0 @@
kind: Docs
body: Fix for column tests not rendering on quoted columns
time: 2023-05-31T11:54:19.687363-04:00
custom:
Author: drewbanin
Issue: "201"

View File

@@ -1,6 +0,0 @@
kind: Docs
body: Remove static SQL codeblock for metrics
time: 2023-07-18T19:24:22.155323+02:00
custom:
Author: marcodamore
Issue: "436"

View File

@@ -0,0 +1,7 @@
kind: Features
body: Show summaries for deprecations and add ability to toggle seeing all deprecation
violation instances
time: 2025-04-03T17:46:59.684525-05:00
custom:
Author: QMalcolm
Issue: "11429"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add behavior flag for handling all warnings via warn_error logic
time: 2025-04-10T11:10:23.344469-05:00
custom:
Author: QMalcolm
Issue: "11116"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Basic jsonschema validation of `dbt_project.yml`
time: 2025-04-14T17:12:09.351572-07:00
custom:
Author: QMalcolm
Issue: "11503"

View File

@@ -0,0 +1,6 @@
kind: Freatures
body: Begin checking YAML files for duplicate keys
time: 2025-04-15T13:37:51.878256-04:00
custom:
Author: peterallenwebb QMalcolm
Issue: "11296"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add deprecation warnings for unexpected blocks in jinja.
time: 2025-04-16T14:44:27.136199-04:00
custom:
Author: peterallenwebb
Issue: "11393"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Begin validating the jsonschema of resource YAML files
time: 2025-04-16T15:17:11.760509-07:00
custom:
Author: QMalcolm
Issue: "11504"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Add deprecation warning for custom top level keys in YAML files.
time: 2025-04-17T00:13:47.744191-04:00
custom:
Author: peterallenwebb
Issue: "11338"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Begin emitting deprecationw warnings for custom keys in config blocks
time: 2025-04-17T11:49:15.056242-07:00
custom:
Author: QMalcolm
Issue: "11337"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Begin emitting deprecation events for custom properties found in objects
time: 2025-04-18T10:42:10.048839-07:00
custom:
Author: QMalcolm
Issue: "11336"

View File

@@ -0,0 +1,6 @@
kind: Features
body: Create a singular deprecations summary event
time: 2025-04-24T15:33:27.252763-05:00
custom:
Author: QMalcolm
Issue: "11536"

View File

@@ -1,6 +0,0 @@
kind: Fixes
body: Enable converting deprecation warnings to errors
time: 2023-07-18T12:55:18.03914-04:00
custom:
Author: michelleark
Issue: "8130"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: datetime.datetime.utcnow() is deprecated as of Python 3.12
time: 2024-03-29T22:36:53.504295426+01:00
custom:
Author: slothkong
Issue: "9791"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Allow copying asset when dbt docs command is run outside the dbt project
time: 2025-01-16T19:26:16.160976423Z
custom:
Author: cedric-orange
Issue: "9308"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Provide required missing context to resolve sql_header in unit tests.
time: 2025-03-27T00:27:11.364727+01:00
custom:
Author: Kayrnt versusfacit
Issue: "9775"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Add pre-commit installation to Docker container for testing compatibility
time: 2025-04-14T17:04:57.692586656+09:00
custom:
Author: kato1208
Issue: "11498"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix duplicate macro error message with multiple macros and multiple patches
time: 2025-04-22T12:28:35.642843-04:00
custom:
Author: gshank
Issue: "4233"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Fix seed path for partial parsing if project directory name changes
time: 2025-04-28T14:15:28.720582-06:00
custom:
Author: aranke
Issue: "11550"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Add `pre-commit` installation to Docker container for testing compatibility
time: 2025-04-30T08:45:12.247827-06:00
custom:
Author: kato1208 dbeatty10
Issue: "11498"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Ensure the right key is associatd with the `CustomKeyInConfigDeprecation` deprecation
time: 2025-05-02T13:18:22.940373-05:00
custom:
Author: QMalcolm
Issue: "11576"

View File

@@ -0,0 +1,6 @@
kind: Fixes
body: Add tags and meta config to exposures
time: 2025-05-08T14:25:42.489888+01:00
custom:
Author: aranke
Issue: "11428"

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Add package 'name' to lock file
time: 2025-04-11T02:16:10.314663+02:00
custom:
Author: jtcohen6
Issue: "11487"

View File

@@ -31,43 +31,7 @@ kinds:
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
- label: Under the Hood
- label: Dependencies
changeFormat: |-
{{- $PRList := list }}
{{- $changes := splitList " " $.Custom.PR }}
{{- range $pullrequest := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/pull/nbr)" | replace "nbr" $pullrequest }}
{{- $PRList = append $PRList $changeLink }}
{{- end -}}
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
skipGlobalChoices: true
additionalChoices:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: PR
label: GitHub Pull Request Number (separated by a single space if multiple)
type: string
minLength: 1
- label: Security
changeFormat: |-
{{- $PRList := list }}
{{- $changes := splitList " " $.Custom.PR }}
{{- range $pullrequest := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/pull/nbr)" | replace "nbr" $pullrequest }}
{{- $PRList = append $PRList $changeLink }}
{{- end -}}
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
skipGlobalChoices: true
additionalChoices:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: PR
label: GitHub Pull Request Number (separated by a single space if multiple)
type: string
minLength: 1
newlines:
afterChangelogHeader: 1
@@ -106,18 +70,10 @@ footerFormat: |
{{- $changeList := splitList " " $change.Custom.Author }}
{{- $IssueList := list }}
{{- $changeLink := $change.Kind }}
{{- if or (eq $change.Kind "Dependencies") (eq $change.Kind "Security") }}
{{- $changes := splitList " " $change.Custom.PR }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/pull/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end -}}
{{- else }}
{{- $changes := splitList " " $change.Custom.Issue }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/issues/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end -}}
{{- $changes := splitList " " $change.Custom.Issue }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/issues/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end }}
{{- /* check if this contributor has other changes associated with them already */}}
{{- if hasKey $contributorDict $author }}

View File

@@ -7,6 +7,9 @@ ignore =
W503 # makes Flake8 work like black
W504
E203 # makes Flake8 work like black
E704 # makes Flake8 work like black
E741
E501 # long line checking is done in black
exclude = test/
per-file-ignores =
*/__init__.py: F401

2
.gitattributes vendored
View File

@@ -1,4 +1,4 @@
core/dbt/include/index.html binary
core/dbt/task/docs/index.html binary
tests/functional/artifacts/data/state/*/manifest.json binary
core/dbt/docs/build/html/searchindex.js binary
core/dbt/docs/build/html/index.html binary

42
.github/CODEOWNERS vendored
View File

@@ -13,48 +13,6 @@
# the core team as a whole will be assigned
* @dbt-labs/core-team
### OSS Tooling Guild
/.github/ @dbt-labs/guild-oss-tooling
.bumpversion.cfg @dbt-labs/guild-oss-tooling
.changie.yaml @dbt-labs/guild-oss-tooling
pre-commit-config.yaml @dbt-labs/guild-oss-tooling
pytest.ini @dbt-labs/guild-oss-tooling
tox.ini @dbt-labs/guild-oss-tooling
pyproject.toml @dbt-labs/guild-oss-tooling
requirements.txt @dbt-labs/guild-oss-tooling
dev_requirements.txt @dbt-labs/guild-oss-tooling
/core/setup.py @dbt-labs/guild-oss-tooling
/core/MANIFEST.in @dbt-labs/guild-oss-tooling
### ADAPTERS
# Adapter interface ("base" + "sql" adapter defaults, cache)
/core/dbt/adapters @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/postgres/setup.py @dbt-labs/core-adapters @dbt-labs/guild-oss-tooling
# Functional tests for adapter plugins
/tests/adapter @dbt-labs/core-adapters
### TESTS
# Overlapping ownership for vast majority of unit + functional tests
# Perf regression testing framework
# This excludes the test project files itself since those aren't specific
# framework changes (excluded by not setting an owner next to it- no owner)
/performance @nathaniel-may
/performance/projects
### ARTIFACTS
/schemas/dbt @dbt-labs/cloud-artifacts

View File

@@ -61,7 +61,7 @@ body:
label: Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **OS**: Ubuntu 24.04
- **Python**: 3.9.12 (`python3 --version`)
- **dbt-core**: 1.1.1 (`dbt --version`)
value: |

18
.github/ISSUE_TEMPLATE/code-docs.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: 📄 Code docs
description: Report an issue for markdown files within this repo, such as README, ARCHITECTURE, etc.
title: "[Code docs] <title>"
labels: ["triage"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this code docs issue!
- type: textarea
attributes:
label: Please describe the issue and your proposals.
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images by clicking this area to highlight it and then dragging files in.
validations:
required: false

View File

@@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose
about: Problems and issues with dbt product documentation hosted on docs.getdbt.com. Issues for markdown files within this repo, such as README, should be opened using the "Code docs" template.
- name: Ask the community for help
url: https://github.com/dbt-labs/docs.getdbt.com/discussions
about: Need help troubleshooting? Check out our guide on how to ask
@@ -9,15 +12,6 @@ contact_links:
- name: Participate in Discussions
url: https://github.com/dbt-labs/dbt-core/discussions
about: Do you have a Big Idea for dbt? Read open discussions, or start a new one
- name: Create an issue for dbt-redshift
url: https://github.com/dbt-labs/dbt-redshift/issues/new/choose
about: Report a bug or request a feature for dbt-redshift
- name: Create an issue for dbt-bigquery
url: https://github.com/dbt-labs/dbt-bigquery/issues/new/choose
about: Report a bug or request a feature for dbt-bigquery
- name: Create an issue for dbt-snowflake
url: https://github.com/dbt-labs/dbt-snowflake/issues/new/choose
about: Report a bug or request a feature for dbt-snowflake
- name: Create an issue for dbt-spark
url: https://github.com/dbt-labs/dbt-spark/issues/new/choose
about: Report a bug or request a feature for dbt-spark
- name: Create an issue for adapters
url: https://github.com/dbt-labs/dbt-adapters/issues/new/choose
about: Report a bug or request a feature for an adapter

View File

@@ -0,0 +1,67 @@
name: 🛠️ Implementation
description: This is an implementation ticket intended for use by the maintainers of dbt-core
title: "[<project>] <title>"
labels: ["user docs"]
body:
- type: markdown
attributes:
value: This is an implementation ticket intended for use by the maintainers of dbt-core
- type: checkboxes
attributes:
label: Housekeeping
description: >
A couple friendly reminders:
1. Remove the `user docs` label if the scope of this work does not require changes to https://docs.getdbt.com/docs: no end-user interface (e.g. yml spec, CLI, error messages, etc) or functional changes
2. Link any blocking issues in the "Blocked on" field under the "Core devs & maintainers" project.
options:
- label: I am a maintainer of dbt-core
required: true
- type: textarea
attributes:
label: Short description
description: |
Describe the scope of the ticket, a high-level implementation approach and any tradeoffs to consider
validations:
required: true
- type: textarea
attributes:
label: Acceptance criteria
description: |
What is the definition of done for this ticket? Include any relevant edge cases and/or test cases
validations:
required: true
- type: textarea
attributes:
label: Suggested Tests
description: |
Provide scenarios to test. Link to existing similar tests if appropriate.
placeholder: |
1. Test with no version specified in the schema file and use selection logic on a versioned model for a specific version. Expect pass.
2. Test with a version specified in the schema file that is no valid. Expect ParsingError.
validations:
required: true
- type: textarea
attributes:
label: Impact to Other Teams
description: |
Will this change impact other teams? Include details of the kinds of changes required (new tests, code changes, related tickets) and _add the relevant `Impact:[team]` label_.
placeholder: |
Example: This change impacts `dbt-redshift` because the tests will need to be modified. The `Impact:[Adapter]` label has been added.
validations:
required: true
- type: textarea
attributes:
label: Will backports be required?
description: |
Will this change need to be backported to previous versions? Add details, possible blockers to backporting and _add the relevant backport labels `backport 1.x.latest`_
placeholder: |
Example: Backport to 1.6.latest, 1.5.latest and 1.4.latest. Since 1.4 isn't using click, the backport may be complicated. The `backport 1.6.latest`, `backport 1.5.latest` and `backport 1.4.latest` labels have been added.
validations:
required: true
- type: textarea
attributes:
label: Context
description: |
Provide the "why", motivation, and alternative approaches considered -- linking to previous refinement issues, spikes and documentation as appropriate
validations:
required: false

View File

@@ -55,7 +55,7 @@ body:
label: Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **OS**: Ubuntu 24.04
- **Python**: 3.9.12 (`python3 --version`)
- **dbt-core (working version)**: 1.1.1 (`dbt --version`)
- **dbt-core (regression version)**: 1.2.0 (`dbt --version`)

11
.github/_README.md vendored
View File

@@ -47,7 +47,8 @@ ___
### How to re-run jobs
- Some actions cannot be rerun in the GitHub UI. Namely the snyk checks and the cla check. Snyk checks are rerun by closing and reopening the PR. You can retrigger the cla check by commenting on the PR with `@cla-bot check`
- From the UI you can rerun from failure
- You can retrigger the cla check by commenting on the PR with `@cla-bot check`
___
@@ -119,7 +120,7 @@ Some triggers of note that we use:
```yaml
jobs:
dependency_changelog:
runs-on: ubuntu-latest
runs-on: ${{ vars.UBUNTU_LATEST }}
steps:
- name: Get File Name Timestamp
@@ -187,6 +188,12 @@ ___
- The [GitHub CLI](https://cli.github.com/) is available in the default runners
- Actions run in your context. ie, using an action from the marketplace that uses the GITHUB_TOKEN uses the GITHUB_TOKEN generated by your workflow run.
### Runners
- We dynamically set runners based on repository vars. Admins can view repository vars and reset them. Current values are the following but are subject to change:
- `vars.UBUNTU_LATEST` -> `ubuntu-latest`
- `vars.WINDOWS_LATEST` -> `windows-latest`
- `vars.MACOS_LATEST` -> `macos-14`
### Actions from the Marketplace
- Dont use external actions for things that can easily be accomplished manually.
- Always read through what an external action does before using it! Often an action in the GitHub Actions Marketplace can be replaced with a few lines in bash. This is much more maintainable (and wont change under us) and clear as to whats actually happening. It also prevents any

View File

@@ -33,7 +33,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.UBUNTU_LATEST }}
steps:
- uses: actions/checkout@v3
- name: Wrangle latest tag

View File

@@ -1,20 +1,21 @@
name: "Github package 'latest' tag wrangler for containers"
description: "Determines wether or not a given dbt container should be given a bare 'latest' tag (I.E. dbt-core:latest)"
name: "GitHub package `latest` tag wrangler for containers"
description: "Determines if the published image should include `latest` tags"
inputs:
package_name:
description: "Package to check (I.E. dbt-core, dbt-redshift, etc)"
description: "Package being published (i.e. `dbt-core`, `dbt-redshift`, etc.)"
required: true
new_version:
description: "Semver of the container being built (I.E. 1.0.4)"
description: "SemVer of the package being published (i.e. 1.7.2, 1.8.0a1, etc.)"
required: true
gh_token:
description: "Auth token for github (must have view packages scope)"
github_token:
description: "Auth token for GitHub (must have view packages scope)"
required: true
outputs:
latest:
description: "Wether or not built container should be tagged latest (bool)"
minor_latest:
description: "Wether or not built container should be tagged minor.latest (bool)"
tags:
description: "A list of tags to associate with this version"
runs:
using: "docker"
image: "Dockerfile"

View File

@@ -3,24 +3,24 @@ on:
workflow_dispatch:
inputs:
package:
description: The package to publish
required: true
description: The package to publish
required: true
version_number:
description: The version number
required: true
description: The version number
required: true
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.UBUNTU_LATEST }}
steps:
- uses: actions/checkout@v3
- name: Wrangle latest tag
id: is_latest
uses: ./.github/actions/latest-wrangler
with:
package: ${{ github.event.inputs.package }}
new_version: ${{ github.event.inputs.new_version }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
- name: Print the results
run: |
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"
- uses: actions/checkout@v3
- name: Wrangle latest tag
id: is_latest
uses: ./.github/actions/latest-wrangler
with:
package: ${{ github.event.inputs.package }}
new_version: ${{ github.event.inputs.new_version }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
- name: Print the results
run: |
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"

View File

@@ -1,98 +1,71 @@
import os
import sys
from packaging.version import Version, parse
import requests
from distutils.util import strtobool
from typing import Union
from packaging.version import parse, Version
import sys
from typing import List
if __name__ == "__main__":
# get inputs
package = os.environ["INPUT_PACKAGE"]
new_version = parse(os.environ["INPUT_NEW_VERSION"])
gh_token = os.environ["INPUT_GH_TOKEN"]
halt_on_missing = strtobool(os.environ.get("INPUT_HALT_ON_MISSING", "False"))
def main():
package_name: str = os.environ["INPUT_PACKAGE_NAME"]
new_version: Version = parse(os.environ["INPUT_NEW_VERSION"])
github_token: str = os.environ["INPUT_GITHUB_TOKEN"]
# get package metadata from github
package_request = requests.get(
f"https://api.github.com/orgs/dbt-labs/packages/container/{package}/versions",
auth=("", gh_token),
)
package_meta = package_request.json()
response = _package_metadata(package_name, github_token)
published_versions = _published_versions(response)
new_version_tags = _new_version_tags(new_version, published_versions)
_register_tags(new_version_tags, package_name)
# Log info if we don't get a 200
if package_request.status_code != 200:
print(f"Call to GH API failed: {package_request.status_code} {package_meta['message']}")
# Make an early exit if there is no matching package in github
if package_request.status_code == 404:
if halt_on_missing:
sys.exit(1)
# everything is the latest if the package doesn't exist
github_output = os.environ.get("GITHUB_OUTPUT")
with open(github_output, "at", encoding="utf-8") as gh_output:
gh_output.write("latest=True")
gh_output.write("minor_latest=True")
sys.exit(0)
def _package_metadata(package_name: str, github_token: str) -> requests.Response:
url = f"https://api.github.com/orgs/dbt-labs/packages/container/{package_name}/versions"
return requests.get(url, auth=("", github_token))
# TODO: verify package meta is "correct"
# https://github.com/dbt-labs/dbt-core/issues/4640
# map versions and tags
version_tag_map = {
version["id"]: version["metadata"]["container"]["tags"] for version in package_meta
}
def _published_versions(response: requests.Response) -> List[Version]:
package_metadata = response.json()
return [
parse(tag)
for version in package_metadata
for tag in version["metadata"]["container"]["tags"]
if "latest" not in tag
]
# is pre-release
pre_rel = True if any(x in str(new_version) for x in ["a", "b", "rc"]) else False
# semver of current latest
for version, tags in version_tag_map.items():
if "latest" in tags:
# N.B. This seems counterintuitive, but we expect any version tagged
# 'latest' to have exactly three associated tags:
# latest, major.minor.latest, and major.minor.patch.
# Subtracting everything that contains the string 'latest' gets us
# the major.minor.patch which is what's needed for comparison.
current_latest = parse([tag for tag in tags if "latest" not in tag][0])
else:
current_latest = False
def _new_version_tags(new_version: Version, published_versions: List[Version]) -> List[str]:
# the package version is always a tag
tags = [str(new_version)]
# semver of current_minor_latest
for version, tags in version_tag_map.items():
if f"{new_version.major}.{new_version.minor}.latest" in tags:
# Similar to above, only now we expect exactly two tags:
# major.minor.patch and major.minor.latest
current_minor_latest = parse([tag for tag in tags if "latest" not in tag][0])
else:
current_minor_latest = False
# pre-releases don't get tagged with `latest`
if new_version.is_prerelease:
return tags
def is_latest(
pre_rel: bool, new_version: Version, remote_latest: Union[bool, Version]
) -> bool:
"""Determine if a given contaier should be tagged 'latest' based on:
- it's pre-release status
- it's version
- the version of a previously identified container tagged 'latest'
if new_version > max(published_versions):
tags.append("latest")
:param pre_rel: Wether or not the version of the new container is a pre-release
:param new_version: The version of the new container
:param remote_latest: The version of the previously identified container that's
already tagged latest or False
"""
# is a pre-release = not latest
if pre_rel:
return False
# + no latest tag found = is latest
if not remote_latest:
return True
# + if remote version is lower than current = is latest, else not latest
return True if remote_latest <= new_version else False
published_patches = [
version
for version in published_versions
if version.major == new_version.major and version.minor == new_version.minor
]
if new_version > max(published_patches):
tags.append(f"{new_version.major}.{new_version.minor}.latest")
latest = is_latest(pre_rel, new_version, current_latest)
minor_latest = is_latest(pre_rel, new_version, current_minor_latest)
return tags
def _register_tags(tags: List[str], package_name: str) -> None:
fully_qualified_tags = ",".join([f"ghcr.io/dbt-labs/{package_name}:{tag}" for tag in tags])
github_output = os.environ.get("GITHUB_OUTPUT")
with open(github_output, "at", encoding="utf-8") as gh_output:
gh_output.write(f"latest={latest}")
gh_output.write(f"minor_latest={minor_latest}")
gh_output.write(f"fully_qualified_tags={fully_qualified_tags}")
def _validate_response(response: requests.Response) -> None:
message = response["message"]
if response.status_code != 200:
print(f"Call to GitHub API failed: {response.status_code} - {message}")
sys.exit(1)
if __name__ == "__main__":
main()

View File

@@ -1,10 +0,0 @@
name: "Set up postgres (linux)"
description: "Set up postgres service on linux vm for dbt integration tests"
runs:
using: "composite"
steps:
- shell: bash
run: |
sudo systemctl start postgresql.service
pg_isready
sudo -u postgres bash ${{ github.action_path }}/setup_db.sh

View File

@@ -1 +0,0 @@
../../../test/setup_db.sh

View File

@@ -1,24 +0,0 @@
name: "Set up postgres (macos)"
description: "Set up postgres service on macos vm for dbt integration tests"
runs:
using: "composite"
steps:
- shell: bash
run: |
brew services start postgresql
echo "Check PostgreSQL service is running"
i=10
COMMAND='pg_isready'
while [ $i -gt -1 ]; do
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "Check PostgreSQL service status"
eval $COMMAND && break
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
((i--))
done
createuser -s postgres
bash ${{ github.action_path }}/setup_db.sh

View File

@@ -1 +0,0 @@
../../../test/setup_db.sh

View File

@@ -5,8 +5,22 @@ runs:
steps:
- shell: pwsh
run: |
$pgService = Get-Service -Name postgresql*
Write-Host -Object "Installing PostgreSQL 16 as windows service..."
$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended")
$filePath = Invoke-DownloadWithRetry -Url "https://get.enterprisedb.com/postgresql/postgresql-16.1-1-windows-x64.exe" -Path "$env:PGROOT/postgresql-16.1-1-windows-x64.exe"
Start-Process -FilePath $filePath -ArgumentList $installerArgs -Wait -PassThru
Write-Host -Object "Validating PostgreSQL 16 Install..."
Get-Service -Name postgresql*
$pgReady = Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
$exitCode = $pgReady.ExitCode
if ($exitCode -ne 0) {
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
exit $exitCode
}
Write-Host -Object "Starting PostgreSQL 16 Service..."
$pgService = Get-Service -Name postgresql-x64-16
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
$env:Path += ";$env:PGBIN"
bash ${{ github.action_path }}/setup_db.sh

View File

@@ -11,11 +11,6 @@ updates:
schedule:
interval: "daily"
rebase-strategy: "disabled"
- package-ecosystem: "pip"
directory: "/plugins/postgres"
schedule:
interval: "daily"
rebase-strategy: "disabled"
# docker dependencies
- package-ecosystem: "docker"
@@ -28,3 +23,10 @@ updates:
schedule:
interval: "weekly"
rebase-strategy: "disabled"
# github dependencies
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
rebase-strategy: "disabled"

View File

@@ -1,15 +1,12 @@
resolves #
[docs](https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose) dbt-labs/docs.getdbt.com/#
Resolves #
<!---
Include the number of the issue addressed by this PR above if applicable.
Include the number of the issue addressed by this PR above, if applicable.
PRs for code changes without an associated issue *will not be merged*.
See CONTRIBUTING.md for more information.
Include the number of the docs issue that was opened for this PR. If
this change has no user-facing implications, "N/A" suffices instead. New
docs tickets can be created by clicking the link above or by going to
https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose.
Add the `user docs` label to this PR if it will need docs changes. An
issue will get opened in docs.getdbt.com upon successful merge of this PR.
-->
### Problem
@@ -29,7 +26,8 @@ resolves #
### Checklist
- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md) and understand what's expected of me
- [ ] 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 has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md) and understand what's expected of me.
- [ ] I have run this code in development, and it appears to resolve the stated issue.
- [ ] This PR includes tests, or tests are not required or relevant for this PR.
- [ ] This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
- [ ] This PR includes [type annotations](https://docs.python.org/3/library/typing.html) for new and modified functions.

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