Skip to content

Commit

Permalink
Merge branch 'main' into allow-control-over-ephemeral-cte-identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 authored Jul 16, 2024
2 parents e5c1b46 + 782a32b commit 8b41bc2
Show file tree
Hide file tree
Showing 54 changed files with 490 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .changes/1.0.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## dbt-adapter 1.0.0 - April 01, 2024
## dbt-adapters 1.0.0 - April 01, 2024

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion .changes/1.1.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## dbt-adapter 1.1.0 - May 01, 2024
## dbt-adapters 1.1.0 - May 01, 2024

### Features

Expand Down
2 changes: 1 addition & 1 deletion .changes/1.1.1.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## dbt-adapter 1.1.1 - May 07, 2024
## dbt-adapters 1.1.1 - May 07, 2024

### Features

Expand Down
2 changes: 1 addition & 1 deletion .changes/1.2.1.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## dbt-adapter 1.2.1 - May 21, 2024
## dbt-adapters 1.2.1 - May 21, 2024

### Features

Expand Down
5 changes: 5 additions & 0 deletions .changes/1.3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## dbt-adapters 1.3.0 - June 18, 2024

### Features

* Add get_catalog_for_single_relation macro and capability to enable adapters to optimize catalog generation
1 change: 1 addition & 0 deletions .changes/1.3.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.3.1 - June 20, 2024
6 changes: 6 additions & 0 deletions .changes/1.3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## dbt-adapters 1.3.2 - July 02, 2024

### Under the Hood

* Fix query timer resolution
* Add optional release_connection parameter to connection_named method
9 changes: 9 additions & 0 deletions .changes/1.3.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## dbt-adapters 1.3.3 - July 09, 2024

### Fixes

* Fix scenario where using the `--empty` flag causes metadata queries to contain limit clauses

### Under the Hood

* --limit flag no longer subshells the query. This resolves the dbt Cloud experience issue where limit prevents ordering elements..
2 changes: 1 addition & 1 deletion .changes/1.8.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## dbt-adapter 1.8.0 - May 09, 2024
## dbt-adapters 1.8.0 - May 09, 2024

### Features

Expand Down
1 change: 1 addition & 0 deletions .changes/1.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.9.0 - June 18, 2024
1 change: 1 addition & 0 deletions .changes/1.9.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.9.1 - June 20, 2024
1 change: 1 addition & 0 deletions .changes/1.9.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## dbt-adapters 1.9.2 - July 09, 2024
2 changes: 1 addition & 1 deletion .changie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
envPrefix: CHANGIE_
versionFormat: '## dbt-adapter {{.Version}} - {{.Time.Format "January 02, 2006"}}'
versionFormat: '## dbt-adapters {{.Version}} - {{.Time.Format "January 02, 2006"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 🐞 Bug
description: Report a bug or an issue you've found with dbt-adapter
description: Report a bug or an issue you've found with dbt-adapters
title: "[Bug] <title>"
labels: ["bug", "triage"]
body:
Expand Down Expand Up @@ -62,11 +62,11 @@ body:
examples:
- **OS**: Ubuntu 20.04
- **Python**: 3.11.6 (`python3 --version`)
- **dbt-adapter**: 1.0.0
- **dbt-adapters**: 1.0.0
value: |
- OS:
- Python:
- dbt-adapter:
- dbt-adapters:
render: markdown
validations:
required: false
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ contact_links:
url: mailto:[email protected]
about: Are you using dbt Cloud? Contact our support team for help!
- name: Participate in Discussions
url: https://github.com/dbt-labs/dbt-adapter/discussions
about: Do you have a Big Idea for dbt-adapter? Read open discussions, or start a new one
url: https://github.com/dbt-labs/dbt-adapters/discussions
about: Do you have a Big Idea for dbt-adapters? Read open discussions, or start a new one
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ✨ Feature
description: Propose a straightforward extension of dbt-adapter functionality
description: Propose a straightforward extension of dbt-adapters functionality
title: "[Feature] <title>"
labels: ["enhancement", "triage"]
body:
Expand All @@ -14,15 +14,15 @@ body:
We want to make sure that features are distinct and discoverable,
so that other members of the community can find them and offer their thoughts.
Issues are the right place to request straightforward extensions of existing dbt-adapter functionality.
For "big ideas" about future capabilities of dbt-adapter, we ask that you open a
[discussion](https://github.com/dbt-labs/dbt-adapter/discussions/new?category=ideas) in the "Ideas" category instead.
Issues are the right place to request straightforward extensions of existing dbt-adapters functionality.
For "big ideas" about future capabilities of dbt-adapters, we ask that you open a
[discussion](https://github.com/dbt-labs/dbt-adapters/discussions/new?category=ideas) in the "Ideas" category instead.
options:
- label: I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
required: true
- label: I have searched the existing issues, and I could not find an existing issue for this feature
required: true
- label: I am requesting a straightforward extension of existing dbt-adapter functionality, rather than a Big Idea better suited to a discussion
- label: I am requesting a straightforward extension of existing dbt-adapters functionality, rather than a Big Idea better suited to a discussion
required: true
- type: textarea
attributes:
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/regression-report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ☣️ Regression
description: Report a regression you've observed in a newer version of dbt-adapter
description: Report a regression you've observed in a newer version of dbt-adapters
title: "[Regression] <title>"
labels: ["regression", "triage"]
body:
Expand Down Expand Up @@ -57,13 +57,13 @@ body:
examples:
- **OS**: Ubuntu 20.04
- **Python**: 3.11.6 (`python3 --version`)
- **dbt-adapter (working version)**: 1.1.0
- **dbt-adapter (regression version)**: 1.2.0
- **dbt-adapters (working version)**: 1.1.0
- **dbt-adapters (regression version)**: 1.2.0
value: |
- OS:
- Python:
- dbt-adapter (working version):
- dbt-adapter (regression version):
- dbt-adapters (working version):
- dbt-adapters (regression version):
render: markdown
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resolves #

### Checklist

- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-adapter/blob/main/CONTRIBUTING.md) and understand what's expected of me
- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-adapters/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
41 changes: 41 additions & 0 deletions .github/workflows/docs-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# **what?**
# Open an issue in docs.getdbt.com when an issue is labeled `user docs` and closed as completed

# **why?**
# To reduce barriers for keeping docs up to date

# **when?**
# When an issue is labeled `user docs` and is closed as completed. Can be labeled before or after the issue is closed.


name: Open issues in docs.getdbt.com repo when an issue is labeled
run-name: "Open an issue in docs.getdbt.com for issue #${{ github.event.issue.number }}"

on:
issues:
types: [labeled, closed]

defaults:
run:
shell: bash

permissions:
issues: write # comments on issues

jobs:
open_issues:
# we only want to run this when the issue is closed as completed and the label `user docs` has been assigned.
# If this logic does not exist in this workflow, it runs the
# risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having
# generating the comment before the other runs. This lives here instead of the shared workflow because this is where we
# decide if it should run or not.
if: |
(github.event.issue.state == 'closed' && github.event.issue.state_reason == 'completed') && (
(github.event.action == 'closed' && contains(github.event.issue.labels.*.name, 'user docs')) ||
(github.event.action == 'labeled' && github.event.label.name == 'user docs'))
uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main
with:
issue_repository: "dbt-labs/docs.getdbt.com"
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}"
issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated."
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:

github-release:
name: "GitHub Release"
# ToDo: update GH release to handle adding dbt-tests-adapter and dbt-adapter assets to the same release
# ToDo: update GH release to handle adding dbt-tests-adapter and dbt-adapters assets to the same release
if: ${{ !failure() && !cancelled() && inputs.package == 'dbt-adapters' }}
needs: [release-inputs, build-and-test, bump-version-generate-changelog]
uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@main
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,13 @@ cython_debug/

# PyCharm
.idea/

# MacOS
.DS_Store

# vscode
.vscode/
.venv/

# Vim
*.swp
41 changes: 36 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## dbt-adapter 1.8.0 - May 09, 2024
## dbt-adapters 1.9.2 - July 09, 2024

## dbt-adapters 1.9.1 - June 20, 2024

## dbt-adapters 1.9.0 - June 18, 2024

## dbt-adapters 1.8.0 - May 09, 2024

### Features

Expand All @@ -15,7 +21,32 @@ and is generated by [Changie](https://github.com/miniscruff/changie).

* Update Clone test to reflect core change removing `deferred` attribute from nodes

## dbt-adapter 1.2.1 - May 21, 2024
## dbt-adapters 1.3.3 - July 09, 2024

### Fixes

* Fix scenario where using the `--empty` flag causes metadata queries to contain limit clauses

### Under the Hood

* --limit flag no longer subshells the query. This resolves the dbt Cloud experience issue where limit prevents ordering elements..

## dbt-adapters 1.3.2 - July 02, 2024

### Under the Hood

* Fix query timer resolution
* Add optional release_connection parameter to connection_named method

## dbt-adapters 1.3.1 - June 20, 2024

## dbt-adapters 1.3.0 - June 18, 2024

### Features

* Add get_catalog_for_single_relation macro and capability to enable adapters to optimize catalog generation

## dbt-adapters 1.2.1 - May 21, 2024

### Features

Expand All @@ -26,13 +57,13 @@ and is generated by [Changie](https://github.com/miniscruff/changie).
* Add query recording for adapters which use SQLConnectionManager
* Improve memory efficiency of process_results()

## dbt-adapter 1.1.1 - May 07, 2024
## dbt-adapters 1.1.1 - May 07, 2024

### Features

* Enable serialization contexts

## dbt-adapter 1.1.0 - May 01, 2024
## dbt-adapters 1.1.0 - May 01, 2024

### Features

Expand Down Expand Up @@ -62,7 +93,7 @@ and is generated by [Changie](https://github.com/miniscruff/changie).

* add support for py3.12

## dbt-adapter 1.0.0 - April 01, 2024
## dbt-adapters 1.0.0 - April 01, 2024

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Remember to commit and push the file that's created.

### Signing the CLA

> **_NOTE:_** All contributors to `dbt-adapter` must sign the
> **_NOTE:_** All contributors to `dbt-adapters` must sign the
> [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements)(CLA).
Maintainers will be unable to merge contributions until the contributor signs the CLA.
Expand Down
2 changes: 1 addition & 1 deletion dbt-tests-adapter/dbt/tests/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.8.0"
version = "1.9.2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import pytest

from dbt.tests.util import run_dbt, get_connection

models__my_table_model_sql = """
select * from {{ ref('my_seed') }}
"""


models__my_view_model_sql = """
{{
config(
materialized='view',
)
}}
select * from {{ ref('my_seed') }}
"""

seed__my_seed_csv = """id,first_name,email,ip_address,updated_at
1,Larry,[email protected],69.135.206.194,2008-09-12 19:08:31
"""


class BaseGetCatalogForSingleRelation:
@pytest.fixture(scope="class")
def project_config_update(self):
return {"name": "get_catalog_for_single_relation"}

@pytest.fixture(scope="class")
def seeds(self):
return {
"my_seed.csv": seed__my_seed_csv,
}

@pytest.fixture(scope="class")
def models(self):
return {
"my_view_model.sql": models__my_view_model_sql,
"my_table_model.sql": models__my_table_model_sql,
}

@pytest.fixture(scope="class")
def expected_catalog_my_seed(self, project):
raise NotImplementedError(
"To use this test, please implement `get_catalog_for_single_relation`, inherited from `SQLAdapter`."
)

@pytest.fixture(scope="class")
def expected_catalog_my_model(self, project):
raise NotImplementedError(
"To use this test, please implement `get_catalog_for_single_relation`, inherited from `SQLAdapter`."
)

def get_relation_for_identifier(self, project, identifier):
return project.adapter.get_relation(
database=project.database,
schema=project.test_schema,
identifier=identifier,
)

def test_get_catalog_for_single_relation(
self, project, expected_catalog_my_seed, expected_catalog_my_view_model
):
results = run_dbt(["seed"])
assert len(results) == 1

my_seed_relation = self.get_relation_for_identifier(project, "my_seed")

with get_connection(project.adapter):
actual_catalog_my_seed = project.adapter.get_catalog_for_single_relation(
my_seed_relation
)

assert actual_catalog_my_seed == expected_catalog_my_seed

results = run_dbt(["run"])
assert len(results) == 2

my_view_model_relation = self.get_relation_for_identifier(project, "my_view_model")

with get_connection(project.adapter):
actual_catalog_my_view_model = project.adapter.get_catalog_for_single_relation(
my_view_model_relation
)

assert actual_catalog_my_view_model == expected_catalog_my_view_model
Loading

0 comments on commit 8b41bc2

Please sign in to comment.