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

version bump python311 exception rename & dbt 14 updates #64

Merged
merged 8 commits into from
Apr 17, 2023
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
12 changes: 6 additions & 6 deletions dbt/adapters/exasol/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import ClassVar, Dict

from dbt.adapters.base.column import Column
from dbt.exceptions import RuntimeException
from dbt.exceptions import DbtRuntimeError


@dataclass
Expand Down Expand Up @@ -52,7 +52,7 @@ def is_date(self) -> bool:

def string_size(self) -> int:
if not self.is_string():
raise RuntimeException("Called string_size() on non-string field!")
raise DbtRuntimeError("Called string_size() on non-string field!")
if self.char_size is None:
return 2000000
return int(self.char_size)
Expand All @@ -66,7 +66,7 @@ def string_type(cls, size: int) -> str:
def from_description(cls, name: str, raw_data_type: str) -> "Column":
match = re.match(r"([^(]+)(\([^)]+\))?", raw_data_type)
if match is None:
raise RuntimeException(f'Could not interpret data type "{raw_data_type}"')
raise DbtRuntimeError(f'Could not interpret data type "{raw_data_type}"')
data_type, size_info = match.groups()
char_size = None
numeric_precision = None
Expand All @@ -81,22 +81,22 @@ def from_description(cls, name: str, raw_data_type: str) -> "Column":
size = re.sub(r"[^\d]", "", parts[0])
char_size = int(size)
except ValueError:
raise RuntimeException(
raise DbtRuntimeError(
f'Could not interpret data_type "{raw_data_type}": '
f'could not convert "{size}" to an integer'
)
elif len(parts) == 2:
try:
numeric_precision = int(parts[0])
except ValueError:
raise RuntimeException(
raise DbtRuntimeError(
f'Could not interpret data_type "{raw_data_type}": '
f'could not convert "{parts[0]}" to an integer'
)
try:
numeric_scale = int(parts[1])
except ValueError:
raise RuntimeException(
raise DbtRuntimeError(
f'Could not interpret data_type "{raw_data_type}": '
f'could not convert "{parts[1]}" to an integer'
)
Expand Down
6 changes: 3 additions & 3 deletions dbt/adapters/exasol/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ def exception_handler(self, sql):
LOGGER.debug(f"Error running SQL: {sql}")
LOGGER.debug("Rolling back transaction.")
self.rollback_if_open()
if isinstance(yielded_exception, dbt.exceptions.RuntimeException):
if isinstance(yielded_exception, dbt.exceptions.DbtRuntimeError):
# during a sql query, an internal to dbt exception was raised.
# this sounds a lot like a signal handler and probably has
# useful information, so raise it without modification.
raise

raise dbt.exceptions.RuntimeException(yielded_exception)
raise dbt.exceptions.DbtRuntimeError(yielded_exception)

@classmethod
def get_result_from_cursor(cls, cursor: Any) -> agate.Table:
Expand Down Expand Up @@ -184,7 +184,7 @@ def open(cls, connection):
else:
protocol_version = pyexasol.PROTOCOL_V3
except:
raise dbt.exceptions.RuntimeException(
raise dbt.exceptions.DbtRuntimeError(
f"{credentials.protocol_version} is not a valid protocol version."
)

Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/exasol/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import agate
from dbt.adapters.sql import SQLAdapter
from dbt.exceptions import raise_compiler_error
from dbt.exceptions import CompilationError
from dbt.utils import filter_null_values

from dbt.adapters.exasol import (ExasolColumn, ExasolConnectionManager,
Expand Down Expand Up @@ -72,7 +72,7 @@ def quote_seed_column(self, column: str, quote_config: Optional[bool]) -> str:
elif quote_config is None:
pass
else:
raise_compiler_error(
raise CompilationError(
f'The seed configuration value of "quote_columns" has an '
f"invalid type {type(quote_config)}"
)
Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/exasol/relation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""dbt-exasol adapter relation module"""
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import Optional, Type, TypeVar

from dbt.adapters.base.relation import BaseRelation, Policy
Expand All @@ -22,7 +22,7 @@ class ExasolQuotePolicy(Policy):
class ExasolRelation(BaseRelation):
"""Relation implementation for exasol"""

quote_policy: ExasolQuotePolicy = ExasolQuotePolicy()
quote_policy: ExasolQuotePolicy = field(default_factory=lambda: ExasolQuotePolicy())

@classmethod
# pylint: disable=too-many-arguments
Expand Down
9 changes: 0 additions & 9 deletions dbt/include/exasol/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ AS
{{ sql }}
{% endmacro %}

{% macro exasol__current_timestamp() -%}
current_timestamp
{%- endmacro %}

{% macro exasol__snapshot_string_as_time(timestamp) -%}
{%- set result = "to_timestamp('" ~ timestamp ~ "')" -%}
{{ return(result) }}
{%- endmacro %}

{% macro exasol__truncate_relation(relation) -%}
{% call statement('truncate_relation') -%}
truncate table {{ relation | replace('"', '') }}
Expand Down
2 changes: 1 addition & 1 deletion dbt/include/exasol/macros/materializations/merge.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro exasol__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}
{% macro exasol__get_delete_insert_merge_sql(target, source, unique_key, dest_columns,incremental_predicates=none) -%}

{%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute="name")) -%}

Expand Down
20 changes: 20 additions & 0 deletions dbt/include/exasol/macros/utils/timestamps.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% macro exasol__current_timestamp() -%}
current_timestamp()
{%- endmacro %}

{% macro exasol__snapshot_string_as_time(timestamp) -%}
{%- set result = "to_timestamp('" ~ timestamp ~ "')" -%}
{{ return(result) }}
{%- endmacro %}

{% macro exasol__snapshot_get_time() -%}
to_timestamp({{ current_timestamp() }})
{%- endmacro %}

{% macro exasol__current_timestamp_backcompat() %}
current_timestamp()
{% endmacro %}

{% macro exasol__current_timestamp_in_utc_backcompat() %}
current_timestamp()
{% endmacro %}
37 changes: 18 additions & 19 deletions okteto.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
name: auxmoney
autocreate: true
image: alligatorcompany/acs-workbench:latest
command: zsh
namespace: dev-torsten
dev:
acsdata:
autocreate: true
image: alligatorcompany/acs-workbench:latest
command: zsh
sync:
- .:/wks
workdir: /wks

sync:
- .:/wks
workdir: /wks
environment:
- DBT_USER=sys
- DBT_PASS=start123
- DBT_PROFILES_DIR=.
- EXASOL_SERVICE_HOST=exasol
- EXASOL_SERVICE_PORT=8563

environment:
- DBT_USER=sys
- DBT_PASS=start123
- DBT_PROFILES_DIR=.
- EXASOL_SERVICE_HOST=exasol
- EXASOL_SERVICE_PORT=8563

forward:
- 8563:exasol:8563
- 8000:dvb:8000
- 8001:dvb:3000
forward:
- 8563:exasol:8563
- 8000:dvb:8000
- 8001:dvb:3000
Loading