Skip to content

Commit

Permalink
Merge branch 'main' into adolfo-console-link-info
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-rogers-dbt committed Mar 25, 2024
2 parents 30e7312 + 955afbd commit 7e6f949
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Dependencies-20240319-102258.yaml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240318-032256.yaml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240322-113720.yaml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20240227-004659.yaml
Original file line number Diff line number Diff line change
@@ -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"
64 changes: 64 additions & 0 deletions .github/workflows/release-internal.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 17 additions & 4 deletions dbt/adapters/bigquery/relation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import FrozenSet, Optional, TypeVar

from itertools import chain, islice
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_renamed_relations.py
Original file line number Diff line number Diff line change
@@ -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,
}
)

0 comments on commit 7e6f949

Please sign in to comment.