Skip to content
Draft
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
7 changes: 4 additions & 3 deletions .github/plugin-discovery/plugin_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@


def main():
out = subprocess.run(["dbt", "--version"], stderr=subprocess.PIPE, text=True)
out = subprocess.run(["dbt", "--version"], capture_output=True, text=True)
print(out.stdout)
plugin_detected = (
re.search(r"Plugins:.*\s- decodable: \d+\.\d+\.\d+", out.stderr, flags=re.DOTALL)
re.search(r"Plugins:\s.*- decodable: \d+\.\d+\.\d+", out.stdout, flags=re.DOTALL)
is not None
)
if not plugin_detected:
sys.exit(
f"Decodable plugin not recognized by dbt! Received output of `dbt --version`:\n{out.stderr}"
f"Decodable plugin not recognized by dbt! Received output of `dbt --version`:\n{out.stdout}"
)


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
python-version: [3.9]

steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/decodable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
from dbt.adapters.decodable.impl import DecodableAdapter

from dbt.adapters.base import AdapterPlugin
import dbt.include.decodable as decodable
import dbt.include.decodable as decodable # pyright: ignore[reportMissingTypeStubs]


Plugin = AdapterPlugin(
adapter=DecodableAdapter,
adapter=DecodableAdapter, # type: ignore
credentials=DecodableAdapterCredentials,
include_path=decodable.PACKAGE_PATH,
)
2 changes: 1 addition & 1 deletion dbt/adapters/decodable/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#

version = "1.3.2"
version = "1.4.0"
18 changes: 9 additions & 9 deletions dbt/adapters/decodable/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

from agate.table import Table
from dbt.adapters.sql.connections import SQLConnectionManager
from dbt.contracts.connection import (
from dbt.adapters.contracts.connection import (
AdapterResponse,
Connection,
Credentials,
)
from dbt.events import AdapterLogger
from dbt.exceptions import RuntimeException
from dbt.adapters.events.logging import AdapterLogger
from dbt.exceptions import DbtRuntimeError

from dbt.adapters.decodable.handler import DecodableCursor, DecodableHandler
from decodable.client.api import StartPosition
Expand Down Expand Up @@ -99,7 +99,7 @@ def exception_handler(self, sql: str):
yield
except Exception as e:
self.logger.error("Exception thrown during execution: {}".format(str(e)))
raise RuntimeException(str(e))
raise DbtRuntimeError(str(e))

@classmethod
def open(cls, connection: Connection) -> Connection:
Expand All @@ -108,7 +108,7 @@ def open(cls, connection: Connection) -> Connection:
and moves it to the "open" state.
"""
if not connection.credentials:
raise RuntimeException("Cannot open a Decodable connection without credentials")
raise DbtRuntimeError("Cannot open a Decodable connection without credentials")

credentials: DecodableAdapterCredentials = connection.credentials
control_plane_client = DecodableClientFactory.create_control_plane_client(
Expand All @@ -125,7 +125,7 @@ def open(cls, connection: Connection) -> Connection:
and len(decodable_connection_test.reason) > 0
):
error_message = f"\nReason: {decodable_connection_test.reason}"
raise RuntimeException(
raise DbtRuntimeError(
f"Status code: {decodable_connection_test.status_code}. Decodable connection failed. Try running 'decodable login' first{error_message}"
)

Expand Down Expand Up @@ -156,18 +156,18 @@ def commit(self) -> Connection:
return self.get_thread_connection()

def execute(
self, sql: str, auto_begin: bool = False, fetch: bool = False
self, sql: str, auto_begin: bool = False, fetch: bool = False, limit: Optional[int] = None
) -> Tuple[AdapterResponse, Table]:
sql = self._add_query_comment(sql)
if fetch:
_, cursor = self.add_query(sql, auto_begin)
response = self.get_response(cursor)
table = self.get_result_from_cursor(cursor)
table = self.get_result_from_cursor(cursor, None)
else:
response = AdapterResponse("OK")
cursor = self._dummy_cursor()
cursor.seed_fake_results()
table = self.get_result_from_cursor(cursor)
table = self.get_result_from_cursor(cursor, None)
return response, table

def _dummy_cursor(self) -> DecodableCursor:
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/decodable/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from time import sleep
from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple

from dbt.events import AdapterLogger
from dbt.adapters.events.logging import AdapterLogger

from decodable.client.api import StartPosition
from decodable.client.client import DecodableControlPlaneApiClient, DecodableDataPlaneApiClient
Expand Down
Loading
Loading