Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "replace dbt/common with dbt-common" #9365

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .changes/unreleased/Dependencies-20240109-120530.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .changes/unreleased/Under the Hood-20240110-105734.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions core/dbt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

### links.py

### logger.py

### main.py

### node_types.py
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/base/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
from typing import Dict, ClassVar, Any, Optional

from dbt_common.exceptions import DbtRuntimeError
from dbt.common.exceptions import DbtRuntimeError


@dataclass
Expand Down
28 changes: 14 additions & 14 deletions core/dbt/adapters/base/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import agate

import dbt.adapters.exceptions
import dbt_common.exceptions.base
import dbt.common.exceptions.base
from dbt.adapters.contracts.connection import (
Connection,
Identifier,
Expand All @@ -38,7 +38,7 @@
MacroQueryStringSetter,
)
from dbt.adapters.events.logging import AdapterLogger
from dbt_common.events.functions import fire_event
from dbt.common.events.functions import fire_event
from dbt.adapters.events.types import (
NewConnection,
ConnectionReused,
Expand All @@ -49,8 +49,8 @@
Rollback,
RollbackFailed,
)
from dbt_common.events.contextvars import get_node_info
from dbt_common.utils import cast_to_str
from dbt.common.events.contextvars import get_node_info
from dbt.common.utils import cast_to_str

SleepTime = Union[int, float] # As taken by time.sleep.
AdapterHandle = Any # Adapter connection handle objects can be any class.
Expand Down Expand Up @@ -99,7 +99,7 @@
def set_thread_connection(self, conn: Connection) -> None:
key = self.get_thread_identifier()
if key in self.thread_connections:
raise dbt_common.exceptions.DbtInternalError(
raise dbt.common.exceptions.DbtInternalError(

Check warning on line 102 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L102

Added line #L102 was not covered by tests
"In set_thread_connection, existing connection exists for {}"
)
self.thread_connections[key] = conn
Expand Down Expand Up @@ -139,7 +139,7 @@
:return: A context manager that handles exceptions raised by the
underlying database.
"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 142 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L142

Added line #L142 was not covered by tests
"`exception_handler` is not implemented for this adapter!"
)

Expand Down Expand Up @@ -275,7 +275,7 @@
@abc.abstractmethod
def cancel_open(self) -> Optional[List[str]]:
"""Cancel all open connections on the adapter. (passable)"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 278 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L278

Added line #L278 was not covered by tests
"`cancel_open` is not implemented for this adapter!"
)

Expand All @@ -290,7 +290,7 @@
This should be thread-safe, or hold the lock if necessary. The given
connection should not be in either in_use or available.
"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 293 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L293

Added line #L293 was not covered by tests
"`open` is not implemented for this adapter!"
)

Expand Down Expand Up @@ -324,14 +324,14 @@
@abc.abstractmethod
def begin(self) -> None:
"""Begin a transaction. (passable)"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 327 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L327

Added line #L327 was not covered by tests
"`begin` is not implemented for this adapter!"
)

@abc.abstractmethod
def commit(self) -> None:
"""Commit a transaction. (passable)"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 334 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L334

Added line #L334 was not covered by tests
"`commit` is not implemented for this adapter!"
)

Expand Down Expand Up @@ -369,7 +369,7 @@
def _rollback(cls, connection: Connection) -> None:
"""Roll back the given connection."""
if connection.transaction_open is False:
raise dbt_common.exceptions.DbtInternalError(
raise dbt.common.exceptions.DbtInternalError(

Check warning on line 372 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L372

Added line #L372 was not covered by tests
f"Tried to rollback transaction on connection "
f'"{connection.name}", but it does not have one open!'
)
Expand Down Expand Up @@ -420,7 +420,7 @@
:return: A tuple of the query status and results (empty if fetch=False).
:rtype: Tuple[AdapterResponse, agate.Table]
"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 423 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L423

Added line #L423 was not covered by tests
"`execute` is not implemented for this adapter!"
)

Expand All @@ -432,14 +432,14 @@

See https://github.com/dbt-labs/dbt-core/issues/8396 for more information.
"""
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 435 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L435

Added line #L435 was not covered by tests
"`add_select_query` is not implemented for this adapter!"
)

@classmethod
def data_type_code_to_name(cls, type_code: Union[int, str]) -> str:
"""Get the string representation of the data type from the type_code."""
# https://peps.python.org/pep-0249/#type-objects
raise dbt_common.exceptions.base.NotImplementedError(
raise dbt.common.exceptions.base.NotImplementedError(

Check warning on line 443 in core/dbt/adapters/base/connections.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/connections.py#L443

Added line #L443 was not covered by tests
"`data_type_code_to_name` is not implemented for this adapter!"
)
12 changes: 6 additions & 6 deletions core/dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from multiprocessing.context import SpawnContext

from dbt.adapters.capability import Capability, CapabilityDict
from dbt_common.contracts.constraints import (
from dbt.common.contracts.constraints import (
ColumnLevelConstraint,
ConstraintType,
ModelLevelConstraint,
Expand All @@ -44,7 +44,7 @@
QuoteConfigTypeError,
)

from dbt_common.exceptions import (
from dbt.common.exceptions import (
NotImplementedError,
DbtInternalError,
DbtRuntimeError,
Expand All @@ -58,15 +58,15 @@
AdapterConfig,
MacroContextGeneratorCallable,
)
from dbt_common.clients.agate_helper import (
from dbt.common.clients.agate_helper import (
empty_table,
get_column_value_uncased,
merge_tables,
table_from_rows,
Integer,
)
from dbt_common.clients.jinja import CallableMacroGenerator
from dbt_common.events.functions import fire_event, warn_or_error
from dbt.common.clients.jinja import CallableMacroGenerator
from dbt.common.events.functions import fire_event, warn_or_error
from dbt.adapters.events.types import (
CacheMiss,
ListRelations,
Expand All @@ -76,7 +76,7 @@
ConstraintNotSupported,
ConstraintNotEnforced,
)
from dbt_common.utils import filter_null_values, executor, cast_to_str, AttrDict
from dbt.common.utils import filter_null_values, executor, cast_to_str, AttrDict

from dbt.adapters.contracts.relation import RelationConfig
from dbt.adapters.base.connections import (
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/base/meta.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import abc
from functools import wraps
from typing import Callable, Optional, Any, FrozenSet, Dict, Set
from dbt_common.events.functions import warn_or_error
from dbt.common.events.functions import warn_or_error
from dbt.adapters.events.types import AdapterDeprecationWarning

Decorator = Callable[[Any], Callable]
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/base/query_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from dbt.adapters.clients.jinja import QueryStringGenerator
from dbt.adapters.contracts.connection import AdapterRequiredConfig, QueryComment
from dbt_common.exceptions import DbtRuntimeError
from dbt.common.exceptions import DbtRuntimeError


class QueryHeaderContextWrapper:
Expand Down
8 changes: 4 additions & 4 deletions core/dbt/adapters/base/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
Path,
)
from dbt.adapters.exceptions import MultipleDatabasesNotAllowedError, ApproximateMatchError
from dbt_common.utils import filter_null_values, deep_merge
from dbt.common.utils import filter_null_values, deep_merge
from dbt.adapters.utils import classproperty

import dbt_common.exceptions
import dbt.common.exceptions


Self = TypeVar("Self", bound="BaseRelation")
Expand Down Expand Up @@ -97,7 +97,7 @@

if not search:
# nothing was passed in
raise dbt_common.exceptions.DbtRuntimeError(
raise dbt.common.exceptions.DbtRuntimeError(

Check warning on line 100 in core/dbt/adapters/base/relation.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/relation.py#L100

Added line #L100 was not covered by tests
"Tried to match relation, but no search path was passed!"
)

Expand Down Expand Up @@ -360,7 +360,7 @@

def __post_init__(self):
if not isinstance(self.information_schema_view, (type(None), str)):
raise dbt_common.exceptions.CompilationError(
raise dbt.common.exceptions.CompilationError(

Check warning on line 363 in core/dbt/adapters/base/relation.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/adapters/base/relation.py#L363

Added line #L363 was not covered by tests
"Got an invalid name: {}".format(self.information_schema_view)
)

Expand Down
5 changes: 2 additions & 3 deletions core/dbt/adapters/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
_make_ref_key_dict,
_ReferenceKey,
)

from dbt.adapters.exceptions.cache import (
NewNameAlreadyInCacheError,
ReferencedLinkNotCachedError,
DependentLinkNotCachedError,
TruncatedModelNameCausedCollisionError,
NoneRelationFoundError,
)
from dbt_common.events.functions import fire_event, fire_event_if
from dbt.common.events.functions import fire_event, fire_event_if
from dbt.adapters.events.types import CacheAction, CacheDumpGraph
from dbt_common.utils.formatting import lowercase
from dbt.common.utils.formatting import lowercase


def dot_separated(key: _ReferenceKey) -> str:
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/clients/jinja.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict, Any
from dbt_common.clients.jinja import BaseMacroGenerator, get_environment
from dbt.common.clients.jinja import BaseMacroGenerator, get_environment


class QueryStringGenerator(BaseMacroGenerator):
Expand Down
12 changes: 6 additions & 6 deletions core/dbt/adapters/contracts/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
from mashumaro.jsonschema.annotations import Pattern

from dbt.adapters.utils import translate_aliases
from dbt_common.exceptions import DbtInternalError
from dbt_common.dataclass_schema import (
from dbt.common.exceptions import DbtInternalError
from dbt.common.dataclass_schema import (
dbtClassMixin,
StrEnum,
ExtensibleDbtClassMixin,
ValidatedStringMixin,
)
from dbt_common.contracts.util import Replaceable
from dbt_common.utils import md5
from dbt.common.contracts.util import Replaceable
from dbt.common.utils import md5

from dbt_common.events.functions import fire_event
from dbt.common.events.functions import fire_event
from dbt.adapters.events.types import NewConnectionOpening

# TODO: this is a very bad dependency - shared global state
from dbt_common.events.contextvars import get_node_info
from dbt.common.events.contextvars import get_node_info


class Identifier(ValidatedStringMixin):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/contracts/macros.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional
from typing_extensions import Protocol

from dbt_common.clients.jinja import MacroProtocol
from dbt.common.clients.jinja import MacroProtocol


class MacroResolverProtocol(Protocol):
Expand Down
8 changes: 4 additions & 4 deletions core/dbt/adapters/contracts/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
)
from typing_extensions import Protocol

from dbt_common.dataclass_schema import dbtClassMixin, StrEnum
from dbt.common.dataclass_schema import dbtClassMixin, StrEnum

from dbt_common.contracts.util import Replaceable
from dbt_common.exceptions import CompilationError, DataclassNotDictError
from dbt_common.utils import deep_merge
from dbt.common.contracts.util import Replaceable
from dbt.common.exceptions import CompilationError, DataclassNotDictError
from dbt.common.utils import deep_merge


class RelationType(StrEnum):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/events/base_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Aliasing common Level classes in order to make custom, but not overly-verbose versions that have PROTO_TYPES_MODULE set to the adapter-specific generated types_pb2 module
from dbt_common.events.base_types import (
from dbt.common.events.base_types import (
BaseEvent,
DynamicLevel as CommonDyanicLevel,
TestLevel as CommonTestLevel,
Expand Down
8 changes: 4 additions & 4 deletions core/dbt/adapters/events/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
AdapterEventWarning,
AdapterEventError,
)
from dbt_common.events import get_event_manager
from dbt_common.events.contextvars import get_node_info
from dbt_common.events.event_handler import set_package_logging
from dbt_common.events.functions import fire_event
from dbt.common.events import get_event_manager
from dbt.common.events.contextvars import get_node_info
from dbt.common.events.event_handler import set_package_logging
from dbt.common.events.functions import fire_event


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/events/types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dbt.adapters.events.base_types import WarnLevel, InfoLevel, ErrorLevel, DebugLevel
from dbt_common.ui import line_wrap_message, warning_tag
from dbt.common.ui import line_wrap_message, warning_tag


def format_adapter_message(name, base_msg, args) -> str:
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/exceptions/alias.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Mapping, Any

from dbt_common.exceptions import DbtValidationError
from dbt.common.exceptions import DbtValidationError


class AliasError(DbtValidationError):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/exceptions/cache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from typing import Dict

from dbt_common.exceptions import DbtInternalError
from dbt.common.exceptions import DbtInternalError


class CacheInconsistencyError(DbtInternalError):
Expand Down
4 changes: 2 additions & 2 deletions core/dbt/adapters/exceptions/compilation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Mapping, Any

from dbt_common.exceptions import CompilationError, DbtDatabaseError
from dbt_common.ui import line_wrap_message
from dbt.common.exceptions import CompilationError, DbtDatabaseError
from dbt.common.ui import line_wrap_message


class MissingConfigError(CompilationError):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/exceptions/connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

from dbt_common.exceptions import DbtRuntimeError, DbtDatabaseError
from dbt.common.exceptions import DbtRuntimeError, DbtDatabaseError


class InvalidConnectionError(DbtRuntimeError):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/adapters/exceptions/database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any

from dbt_common.exceptions import NotImplementedError, CompilationError
from dbt.common.exceptions import NotImplementedError, CompilationError


class UnexpectedDbReferenceError(NotImplementedError):
Expand Down
Loading
Loading