diff --git a/.changes/unreleased/Dependencies-20240319-102258.yaml b/.changes/unreleased/Dependencies-20240319-102258.yaml new file mode 100644 index 000000000..5df197537 --- /dev/null +++ b/.changes/unreleased/Dependencies-20240319-102258.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: hard pin ddtrace to 2.3.0 +time: 2024-03-19T10:22:58.3838-05:00 +custom: + Author: McKnight-42 + PR: "1141" diff --git a/.changes/unreleased/Features-20240318-032256.yaml b/.changes/unreleased/Features-20240318-032256.yaml new file mode 100644 index 000000000..e4948f433 --- /dev/null +++ b/.changes/unreleased/Features-20240318-032256.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Add new workflow for internal patch releases +time: 2024-03-18T03:22:56.037781-07:00 +custom: + Author: versusfacit + Issue: "38" diff --git a/.changes/unreleased/Fixes-20240322-113720.yaml b/.changes/unreleased/Fixes-20240322-113720.yaml new file mode 100644 index 000000000..9279c6ecd --- /dev/null +++ b/.changes/unreleased/Fixes-20240322-113720.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: remove `keyfile` from `_connection_keys` +time: 2024-03-22T11:37:20.989189-05:00 +custom: + Author: McKnight-42 + Issue: "1146" diff --git a/.changes/unreleased/Under the Hood-20240227-004659.yaml b/.changes/unreleased/Under the Hood-20240227-004659.yaml new file mode 100644 index 000000000..6ef259019 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240227-004659.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Add unit test for transaction semantics. +time: 2024-02-27T00:46:59.188231-08:00 +custom: + Author: versusfacit + Issue: "1123" diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml new file mode 100644 index 000000000..5bc6cd667 --- /dev/null +++ b/.github/workflows/release-internal.yml @@ -0,0 +1,64 @@ +name: Release internal patch + +on: + workflow_dispatch: + inputs: + version_number: + description: "The release version number (i.e. 1.0.0b1)" + type: string + required: true + sha: + description: "The sha to use (leave empty to use latest on main)" + type: string + required: false + package_test_command: + description: "Package test command" + type: string + default: "python -c \"import dbt.adapters.bigquery\"" + required: true + dbms_name: + description: "The name of the warehouse the adapter connects to." + type: string + default: "bigquery" + required: true + workflow_call: + inputs: + version_number: + description: "The release version number (i.e. 1.0.0b1)" + type: string + required: true + sha: + description: "The sha to use (leave empty to use latest on main)" + type: string + required: false + package_test_command: + description: "Package test command" + type: string + default: "python -c \"import dbt.adapters.bigquery\"" + required: true + dbms_name: + description: "The name of the warehouse the adapter connects to." + type: string + default: "bigquery" + required: true + +defaults: + run: + shell: bash + +env: + PYTHON_TARGET_VERSION: 3.11 + +jobs: + invoke-reusable-workflow: + name: Build and Release Internally + + uses: VersusFacit/dbt-release/.github/workflows/internal-archive-release.yml@main + + with: + version_number: ${{ inputs.version_number }} + package_test_command: ${{ inputs.package_test_command }} + dbms_name: ${{ inputs.dbms_name }} + sha: ${{ inputs.sha }} + + secrets: inherit diff --git a/dbt/adapters/bigquery/connections.py b/dbt/adapters/bigquery/connections.py index 3c64ac32a..59f9acce6 100644 --- a/dbt/adapters/bigquery/connections.py +++ b/dbt/adapters/bigquery/connections.py @@ -195,7 +195,6 @@ def _connection_keys(self): "job_retries", "job_creation_timeout_seconds", "job_execution_timeout_seconds", - "keyfile", "timeout_seconds", "client_id", "token_uri", diff --git a/dbt/adapters/bigquery/relation.py b/dbt/adapters/bigquery/relation.py index 8abda577b..3a3a7fbe6 100644 --- a/dbt/adapters/bigquery/relation.py +++ b/dbt/adapters/bigquery/relation.py @@ -1,4 +1,4 @@ -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import FrozenSet, Optional, TypeVar from itertools import chain, islice @@ -23,9 +23,22 @@ class BigQueryRelation(BaseRelation): quote_character: str = "`" location: Optional[str] = None - renameable_relations: FrozenSet[RelationType] = frozenset({RelationType.Table}) - replaceable_relations: FrozenSet[RelationType] = frozenset( - {RelationType.Table, RelationType.View} + + renameable_relations: FrozenSet[RelationType] = field( + default_factory=lambda: frozenset( + { + RelationType.Table, + } + ) + ) + + replaceable_relations: FrozenSet[RelationType] = field( + default_factory=lambda: frozenset( + { + RelationType.View, + RelationType.Table, + } + ) ) def matches( diff --git a/dev-requirements.txt b/dev-requirements.txt index 0af563a7d..331d4e31f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,7 +9,7 @@ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter black~=23.12 bumpversion~=0.6.0 click~=8.1 -ddtrace~=2.3 +ddtrace==2.3.0 flake8~=6.1 flaky~=3.7 freezegun~=1.3 diff --git a/tests/unit/test_renamed_relations.py b/tests/unit/test_renamed_relations.py new file mode 100644 index 000000000..8e787e6a3 --- /dev/null +++ b/tests/unit/test_renamed_relations.py @@ -0,0 +1,16 @@ +from dbt.adapters.bigquery.relation import BigQueryRelation +from dbt.adapters.contracts.relation import RelationType + + +def test_renameable_relation(): + relation = BigQueryRelation.create( + database="my_db", + schema="my_schema", + identifier="my_table", + type=RelationType.Table, + ) + assert relation.renameable_relations == frozenset( + { + RelationType.Table, + } + )