Skip to content

Commit

Permalink
update(lint): revert type-checking add from prev commit + clean_up ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
coetzeevs authored and Coetzee van Staden committed Feb 9, 2025
1 parent adf2756 commit 970d0bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
11 changes: 4 additions & 7 deletions tap_mysql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import datetime
from typing import TYPE_CHECKING, Any, TypeAlias
from typing import TYPE_CHECKING, Any

import singer_sdk.helpers._typing
import sqlalchemy
Expand All @@ -12,13 +12,13 @@
from singer_sdk._singerlib import CatalogEntry, MetadataMapping, Schema
from singer_sdk.helpers._typing import TypeConformanceLevel
from sqlalchemy import text
from sqlalchemy.engine.reflection import ReflectedValue

if TYPE_CHECKING:
from collections.abc import Iterable

from sqlalchemy.engine import Engine
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.engine.reflection import Inspector, ReflectedPrimaryKeyConstraint


unpatched_conform = (
singer_sdk.helpers._typing._conform_primitive_property # noqa: SLF001
Expand Down Expand Up @@ -218,9 +218,6 @@ def get_schema_names(self, engine: Engine, inspected: Inspector) -> list[str]:
return self.config["filter_schemas"]
return super().get_schema_names(engine, inspected)

# Create a new type alias for the reflected_pk type
ReflectedPKType: TypeAlias = list[ReflectedValue] | ReflectedValue | None

def discover_catalog_entry( # noqa: PLR0913
self,
engine: Engine,
Expand All @@ -230,7 +227,7 @@ def discover_catalog_entry( # noqa: PLR0913
is_view: bool, # noqa: FBT001
*,
reflected_columns: list[Any] | None = None,
reflected_pk: ReflectedPKType = None,
reflected_pk: ReflectedPrimaryKeyConstraint | None = None,
reflected_indices: list[Any] | None = None,
) -> CatalogEntry:
"""Create `CatalogEntry` object for the given table or a view.
Expand Down
10 changes: 3 additions & 7 deletions tap_mysql/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,9 @@ def ssh_tunnel_connect(self, *, ssh_config: dict[str, Any], url: URL) -> URL:

def clean_up(self) -> None:
"""Stop the SSH Tunnel."""
try:
if self.logger and self.logger.handlers:
self.logger.info("Shutting down SSH Tunnel")
except Exception as e:
print(f"Error logging shutdown: {e}")
finally:
self.ssh_tunnel.stop()
if self.logger and self.logger.handlers:
self.logger.info("Shutting down SSH Tunnel")
self.ssh_tunnel.stop()

def catch_signal(self, signum, frame) -> None: # noqa: ANN001 ARG002
"""Catch signals and exit cleanly.
Expand Down

0 comments on commit 970d0bf

Please sign in to comment.