Skip to content

Commit

Permalink
added _target_conector and property
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzCutNorman committed Jul 20, 2023
1 parent 384cff7 commit 4a84b47
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions singer_sdk/target_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
if t.TYPE_CHECKING:
from pathlib import PurePath

from singer_sdk.connectors import SQLConnector
from singer_sdk.mapper import PluginMapper
from singer_sdk.sinks import Sink

Expand Down Expand Up @@ -574,6 +575,21 @@ def get_singer_command(cls: type[Target]) -> click.Command:
class SQLTarget(Target):
"""Target implementation for SQL destinations."""

_target_connector: SQLConnector | None = None

@property
def target_connector(self) -> SQLConnector:
"""The connector object.
Returns:
The connector object.
"""
if self._target_connector is None:
self._target_connector = self.default_sink_class.connector_class(
dict(self.config),
)
return self._target_connector

@classproperty
def capabilities(self) -> list[CapabilitiesEnum]:
"""Get target capabilities.
Expand Down

0 comments on commit 4a84b47

Please sign in to comment.